From 35b2b9b6e6079902d78602afce10e2e3bb9e6b40 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 18 Jun 2022 15:02:18 +1000 Subject: Fix T98793: Wayland clamps cursor movement fails with gnome-shell The current gnome-shell (v42.2) has a bug where grabbing the cursor doesn't scale the region when confining it to the window. For Hi-DPI displays this means the cursor may be confined to a quarter of the window, making grab unusable. Even though this has been fixed up-stream the issue remains in the latest release - so workaround the problem by implementing window confined grab using a software cursor. This is only used gnome-shell for displays that use Hi-DPI scaling. --- source/blender/windowmanager/intern/wm_draw.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_draw.c') diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 63a7fb5ddaa..abf7aa65da7 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -158,9 +158,13 @@ static bool wm_software_cursor_needed_for_window(const wmWindow *win, struct Gra if (GHOST_GetCursorVisibility(win->ghostwin)) { /* NOTE: The value in `win->grabcursor` can't be used as it * doesn't always match GHOST's value in the case of tablet events. */ - GHOST_GetCursorGrabState( - win->ghostwin, &grab_state->mode, &grab_state->wrap_axis, grab_state->bounds); - if (grab_state->mode == GHOST_kGrabWrap) { + bool use_software_cursor; + GHOST_GetCursorGrabState(win->ghostwin, + &grab_state->mode, + &grab_state->wrap_axis, + grab_state->bounds, + &use_software_cursor); + if (use_software_cursor) { return true; } } -- cgit v1.2.3