Capture mouse by default on debug builds too

This commit is contained in:
Cameron Gutman
2020-05-01 18:43:54 -07:00
parent b75f662c41
commit d8270dfb6a
+15 -23
View File
@@ -1129,33 +1129,25 @@ void Session::exec(int displayOriginX, int displayOriginY)
bool needsFirstEnterCapture = false; bool needsFirstEnterCapture = false;
// Capture the mouse in relative mode by default on release builds only. // HACK: For Wayland, we wait until we get the first SDL_WINDOWEVENT_ENTER
// This prevents the mouse from becoming trapped inside Moonlight when // event where it seems to work consistently on GNOME. This doesn't work for
// it's halted at a debug break. // XWayland though.
#ifdef QT_DEBUG if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) {
if (prefs.absoluteMouseMode) // We know we aren't running on native Wayland now, but
#endif // we still may be running on XWayland.
{ if (!WMUtils::isRunningWayland()) {
// HACK: For Wayland, we wait until we get the first SDL_WINDOWEVENT_ENTER // Neither Wayland or XWayland: capture now
// event where it seems to work consistently on GNOME. This doesn't work for m_InputHandler->setCaptureActive(true);
// 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.
}
} }
else { else {
// Native Wayland: Capture on SDL_WINDOWEVENT_ENTER // XWayland: mouse capture doesn't work reliably, so let the user
needsFirstEnterCapture = true; // 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 // Stop text input. SDL enables it by default
// when we initialize the video subsystem, but this // when we initialize the video subsystem, but this