From 4e4fc8c276c552904c27652b0d7734e92f2fffbb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Oct 2023 15:42:11 +1100 Subject: [PATCH] Fix #107523: Cursor not cleared when panning stops --- source/blender/windowmanager/intern/wm_draw.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_draw.cc b/source/blender/windowmanager/intern/wm_draw.cc index 3368d3d079d..62040ee8f8f 100644 --- a/source/blender/windowmanager/intern/wm_draw.cc +++ b/source/blender/windowmanager/intern/wm_draw.cc @@ -232,6 +232,13 @@ static void wm_software_cursor_motion_clear() g_software_cursor.xy[1] = -1; } +static void wm_software_cursor_motion_clear_with_window(const wmWindow *win) +{ + if (g_software_cursor.winid == win->winid) { + wm_software_cursor_motion_clear(); + } +} + static void wm_software_cursor_draw_bitmap(const int event_xy[2], const GHOST_CursorBitmapRef *bitmap) { @@ -1144,7 +1151,8 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view) wm_software_cursor_motion_update(win); } else { - wm_software_cursor_motion_clear(); + /* Checking the window is needed so one window doesn't clear the cursor state of another. */ + wm_software_cursor_motion_clear_with_window(win); } } @@ -1486,7 +1494,7 @@ static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win) 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) { + if (g_software_cursor.winid == win->winid) { return true; } }