From 11d274ff070b845ff249aa4693ea07d193bfa019 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 15 Jan 2021 19:32:38 -0600 Subject: [PATCH] Fix X11 keyboard grab when starting in windowed mode --- app/streaming/session.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 67860fb4..43eb898c 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -944,8 +944,10 @@ void Session::toggleFullscreen() bool fullScreen = !(SDL_GetWindowFlags(m_Window) & m_FullScreenFlag); if (fullScreen) { - if (m_FullScreenFlag == SDL_WINDOW_FULLSCREEN && m_InputHandler->isCaptureActive()) { - // Confine the cursor to the window if we're capturing input + if ((m_FullScreenFlag == SDL_WINDOW_FULLSCREEN || m_Preferences->captureSysKeys) && m_InputHandler->isCaptureActive()) { + // Confine the cursor to the window if we're capturing input while transitioning to full screen. + // We also need to grab if we're capturing system keys, because SDL requires window grab to + // capture the keyboard on X11. SDL_SetWindowGrab(m_Window, SDL_TRUE); }