[client] wm/wayload: implement keyboard grabbing

This commit is contained in:
Quantum
2021-01-11 23:22:17 -05:00
committed by Geoffrey McRae
parent b58176fcdb
commit 24a4de6d65
3 changed files with 49 additions and 0 deletions

View File

@@ -1240,12 +1240,26 @@ int eventFilter(void * userdata, SDL_Event * event)
case SDL_WINDOWEVENT_FOCUS_GAINED:
if (g_state.wminfo.subsystem != SDL_SYSWM_X11)
{
g_state.focused = true;
if (!inputEnabled())
break;
if (params.grabKeyboardOnFocus)
wmGrabKeyboard();
}
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
if (g_state.wminfo.subsystem != SDL_SYSWM_X11)
{
g_state.focused = false;
if (!inputEnabled())
break;
if (params.grabKeyboardOnFocus)
wmUngrabKeyboard();
}
break;
case SDL_WINDOWEVENT_SIZE_CHANGED: