From d8270dfb6a7b7a9444822dfb6eb5bd92b400b3dc Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 1 May 2020 18:43:54 -0700 Subject: [PATCH] Capture mouse by default on debug builds too --- app/streaming/session.cpp | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 8fdc5a62..e7b4dbb2 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -1129,33 +1129,25 @@ void Session::exec(int displayOriginX, int displayOriginY) bool needsFirstEnterCapture = false; - // Capture the mouse in relative mode by default on release builds only. - // This prevents the mouse from becoming trapped inside Moonlight when - // it's halted at a debug break. -#ifdef QT_DEBUG - if (prefs.absoluteMouseMode) -#endif - { - // HACK: For Wayland, we wait until we get the first SDL_WINDOWEVENT_ENTER - // event where it seems to work consistently on GNOME. This doesn't work for - // XWayland though. - if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) { - // We know we aren't running on native Wayland now, but - // we still may be running on XWayland. - if (!WMUtils::isRunningWayland()) { - // Neither Wayland or XWayland: capture now - m_InputHandler->setCaptureActive(true); - } - else { - // XWayland: mouse capture doesn't work reliably, so let the user - // engage the mouse capture via clicking or using the hotkey. - } + // HACK: For Wayland, we wait until we get the first SDL_WINDOWEVENT_ENTER + // event where it seems to work consistently on GNOME. This doesn't work for + // XWayland though. + if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) { + // We know we aren't running on native Wayland now, but + // we still may be running on XWayland. + if (!WMUtils::isRunningWayland()) { + // Neither Wayland or XWayland: capture now + m_InputHandler->setCaptureActive(true); } else { - // Native Wayland: Capture on SDL_WINDOWEVENT_ENTER - needsFirstEnterCapture = true; + // XWayland: mouse capture doesn't work reliably, so let the user + // engage the mouse capture via clicking or using the hotkey. } } + else { + // Native Wayland: Capture on SDL_WINDOWEVENT_ENTER + needsFirstEnterCapture = true; + } // Stop text input. SDL enables it by default // when we initialize the video subsystem, but this