From 52c6455ca53611c95112d7035d1e3ab478f059f2 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 8 Sep 2018 14:05:42 -0700 Subject: [PATCH] Avoid sending a click event on focus gain on Linux --- app/streaming/session.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 99c8f73a..2de998a4 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -932,10 +932,14 @@ void Session::exec(int displayOriginX, int displayOriginY) // Capture mouse cursor when user actives the window by clicking on // window's client area (borders and title bar excluded). // Without this you would have to click the window twice (once to - // active it, second time to enable capture). With this you need to + // activate it, second time to enable capture). With this you need to // click it only once. + // On Linux, the button press event is delivered after the focus gain + // so this is not neccessary (and leads to a click sent to the host + // when focusing the window by clicking). // By excluding window's borders and title bar out, lets user still // interact with them without mouse capture kicking in. +#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) { int mouseX, mouseY; Uint32 mouseState = SDL_GetGlobalMouseState(&mouseX, &mouseY); @@ -948,6 +952,7 @@ void Session::exec(int displayOriginX, int displayOriginY) } } } +#endif // Release mouse cursor when another window is activated (e.g. by using ALT+TAB). // This lets user to interact with our window's title bar and with the buttons in it.