Skip to content

Commit f8bace9

Browse files
committed
Remove the behavior of warping the mouse on fullscreen transitions
This made sense when switching between a window and an exclusive fullscreen video mode of the same dimensions, but it causes user confusion when the window changes size, and doesn't work well with Wayland. I've gotten this feedback from several sources, so we'll just go ahead and remove this behavior for now. Fixes #11577
1 parent a1d3fc1 commit f8bace9

File tree

4 files changed

+1
-35
lines changed

4 files changed

+1
-35
lines changed

src/video/SDL_sysvideo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ typedef enum
191191
VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS = 0x04,
192192
VIDEO_DEVICE_CAPS_FULLSCREEN_ONLY = 0x08,
193193
VIDEO_DEVICE_CAPS_SENDS_DISPLAY_CHANGES = 0x10,
194-
VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS = 0x20,
195-
VIDEO_DEVICE_CAPS_SENDS_HDR_CHANGES = 0x40
194+
VIDEO_DEVICE_CAPS_SENDS_HDR_CHANGES = 0x20
196195
} DeviceCaps;
197196

198197
// Fullscreen operations

src/video/SDL_video.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,6 @@ static bool SDL_SendsDisplayChanges(SDL_VideoDevice *_this)
217217
return !!(_this->device_caps & VIDEO_DEVICE_CAPS_SENDS_DISPLAY_CHANGES);
218218
}
219219

220-
static bool SDL_DisableMouseWarpOnFullscreenTransitions(SDL_VideoDevice *_this)
221-
{
222-
return !!(_this->device_caps & VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS);
223-
}
224-
225220
static bool SDL_DriverSendsHDRChanges(SDL_VideoDevice *_this)
226221
{
227222
return !!(_this->device_caps & VIDEO_DEVICE_CAPS_SENDS_HDR_CHANGES);
@@ -1876,22 +1871,6 @@ static void SDL_CheckWindowDisplayScaleChanged(SDL_Window *window)
18761871
}
18771872
}
18781873

1879-
static void SDL_RestoreMousePosition(SDL_Window *window)
1880-
{
1881-
float x, y;
1882-
SDL_Mouse *mouse = SDL_GetMouse();
1883-
1884-
if (window == SDL_GetMouseFocus()) {
1885-
const bool prev_warp_val = mouse->warp_emulation_prohibited;
1886-
SDL_GetMouseState(&x, &y);
1887-
1888-
// Disable the warp emulation so it isn't accidentally activated on a fullscreen transitions.
1889-
mouse->warp_emulation_prohibited = true;
1890-
SDL_WarpMouseInWindow(window, x, y);
1891-
mouse->warp_emulation_prohibited = prev_warp_val;
1892-
}
1893-
}
1894-
18951874
bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, bool commit)
18961875
{
18971876
SDL_VideoDisplay *display = NULL;
@@ -2056,11 +2035,6 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
20562035
SDL_OnWindowResized(window);
20572036
}
20582037
}
2059-
2060-
// Restore the cursor position
2061-
if (!SDL_DisableMouseWarpOnFullscreenTransitions(_this)) {
2062-
SDL_RestoreMousePosition(window);
2063-
}
20642038
}
20652039
} else {
20662040
bool resized = false;
@@ -2105,11 +2079,6 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
21052079
SDL_OnWindowResized(window);
21062080
}
21072081
}
2108-
2109-
// Restore the cursor position if we've exited fullscreen on a display
2110-
if (display && !SDL_DisableMouseWarpOnFullscreenTransitions(_this)) {
2111-
SDL_RestoreMousePosition(window);
2112-
}
21132082
}
21142083
}
21152084

src/video/wayland/SDL_waylandvideo.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,6 @@ static SDL_VideoDevice *Wayland_CreateDevice(bool require_preferred_protocols)
690690
VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT |
691691
VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS |
692692
VIDEO_DEVICE_CAPS_SENDS_DISPLAY_CHANGES |
693-
VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS |
694693
VIDEO_DEVICE_CAPS_SENDS_HDR_CHANGES;
695694

696695
return device;

src/video/x11/SDL_x11video.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ static SDL_VideoDevice *X11_CreateDevice(void)
263263
SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "Detected XWayland");
264264

265265
device->device_caps |= VIDEO_DEVICE_CAPS_MODE_SWITCHING_EMULATED |
266-
VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS |
267266
VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS;
268267
}
269268

0 commit comments

Comments
 (0)