From 7283bb046b8ece62e671a1b2da823702318be01a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 26 Apr 2020 19:33:25 -0700 Subject: [PATCH] Disable initial mouse capture on XWayland --- app/streaming/session.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 55c8ff55..30e946d6 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -1140,11 +1140,22 @@ void Session::exec(int displayOriginX, int displayOriginY) #endif { // HACK: For Wayland, we wait until we get the first SDL_WINDOWEVENT_ENTER - // event where it seems to work consistently on GNOME. + // event where it seems to work consistently on GNOME. This doesn't work for + // XWayland though. if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) { - m_InputHandler->setCaptureActive(true); + // 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. + } } else { + // Native Wayland: Capture on SDL_WINDOWEVENT_ENTER needsFirstEnterCapture = true; } }