[client] spice: don't grab the keyboard input unless we are focused

This commit is contained in:
Geoffrey McRae 2021-01-08 20:26:32 +11:00
parent f352463d19
commit 59ea957d0d
2 changed files with 21 additions and 13 deletions

View file

@ -898,6 +898,8 @@ static void handleMouseNormal(double ex, double ey)
g_cursor.pos.y < g_state.dstRect.y + g_state.dstRect.h;
if (inView)
{
if (g_state.focused)
{
/* the cursor moved in, enable grab mode */
g_cursor.inView = true;
@ -913,6 +915,7 @@ static void handleMouseNormal(double ex, double ey)
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;

View file

@ -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;