mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 14:21:57 +00:00
[client] spice: don't grab the keyboard input unless we are focused
This commit is contained in:
parent
f352463d19
commit
59ea957d0d
2 changed files with 21 additions and 13 deletions
|
@ -899,20 +899,23 @@ static void handleMouseNormal(double ex, double ey)
|
|||
|
||||
if (inView)
|
||||
{
|
||||
/* the cursor moved in, enable grab mode */
|
||||
g_cursor.inView = true;
|
||||
g_cursor.warpState = WARP_STATE_ON;
|
||||
if (g_state.focused)
|
||||
{
|
||||
/* the cursor moved in, enable grab mode */
|
||||
g_cursor.inView = true;
|
||||
g_cursor.warpState = WARP_STATE_ON;
|
||||
|
||||
XGrabPointer(
|
||||
g_state.wminfo.info.x11.display,
|
||||
g_state.wminfo.info.x11.window,
|
||||
true,
|
||||
None,
|
||||
GrabModeAsync,
|
||||
GrabModeAsync,
|
||||
g_state.wminfo.info.x11.window,
|
||||
None,
|
||||
CurrentTime);
|
||||
XGrabPointer(
|
||||
g_state.wminfo.info.x11.display,
|
||||
g_state.wminfo.info.x11.window,
|
||||
true,
|
||||
None,
|
||||
GrabModeAsync,
|
||||
GrabModeAsync,
|
||||
g_state.wminfo.info.x11.window,
|
||||
None,
|
||||
CurrentTime);
|
||||
}
|
||||
|
||||
struct DoublePoint guest =
|
||||
{
|
||||
|
@ -1314,6 +1317,8 @@ int eventFilter(void * userdata, SDL_Event * event)
|
|||
}
|
||||
|
||||
case FocusIn:
|
||||
g_state.focused = true;
|
||||
|
||||
if (!params.useSpiceInput)
|
||||
break;
|
||||
|
||||
|
@ -1323,6 +1328,8 @@ int eventFilter(void * userdata, SDL_Event * event)
|
|||
break;
|
||||
|
||||
case FocusOut:
|
||||
g_state.focused = false;
|
||||
|
||||
if (!params.useSpiceInput)
|
||||
break;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ struct AppState
|
|||
SDL_Point windowPos;
|
||||
int windowW, windowH;
|
||||
int windowCX, windowCY;
|
||||
bool focused;
|
||||
SDL_Rect border;
|
||||
SDL_Point srcSize;
|
||||
LG_RendererRect dstRect;
|
||||
|
|
Loading…
Reference in a new issue