From ebfe035a185c37446c1fb49bfc78931ccd95be0e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 27 Apr 2024 16:49:51 -0500 Subject: [PATCH] Set SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP=0 to resolve pointer lock issue on Wayland SDL will try to lock the mouse cursor on Wayland if it's not visible in order to support applications that assume they can warp the cursor (which isn't possible on Wayland). We don't want this behavior because it interferes with seamless mouse mode when toggling between windowed and fullscreen modes by unexpectedly locking the mouse cursor. --- app/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/main.cpp b/app/main.cpp index ee079bc6..a9ad569c 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -519,6 +519,13 @@ int main(int argc, char *argv[]) // SDL doing it for us behind our backs. SDL_SetHint("SDL_MOUSE_AUTO_CAPTURE", "0"); + // SDL will try to lock the mouse cursor on Wayland if it's not visible in order to + // support applications that assume they can warp the cursor (which isn't possible + // on Wayland). We don't want this behavior because it interferes with seamless mouse + // mode when toggling between windowed and fullscreen modes by unexpectedly locking + // the mouse cursor. + SDL_SetHint("SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP", "0"); + #ifdef QT_DEBUG // Allow thread naming using exceptions on debug builds. SDL doesn't use SEH // when throwing the exceptions, so we don't enable it for release builds out