From 4acbb84efaf874717e5d29ad456880ce70ab929c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 15 Jun 2022 15:44:16 +1000 Subject: GHOST/Wayland: resolve glitch drawing the software cursor When grab was disabled, the software cursor would remain displayed in the image view. Ensure an additional redraw is done to clear the cursor. --- source/blender/windowmanager/intern/wm_draw.c | 14 +++++++++++--- 1 file changed, 11 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 c2a63c9db7a..63a7fb5ddaa 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -1153,9 +1153,17 @@ static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win) if (wm_software_cursor_needed()) { struct GrabState grab_state; - if (wm_software_cursor_needed_for_window(win, &grab_state) && - wm_software_cursor_motion_test(win)) { - return true; + if (wm_software_cursor_needed_for_window(win, &grab_state)) { + if (wm_software_cursor_motion_test(win)) { + return true; + } + } + else { + /* Detect the edge case when the previous draw used the software cursor but this one doesn't, + * it's important to redraw otherwise the software cursor will remain displayed. */ + if (g_software_cursor.winid != -1) { + return true; + } } } -- cgit v1.2.3