diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-29 09:32:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-29 09:43:51 +0300 |
commit | 94b7e1dcc6fa7d4a66dca0a24cdccf3b404bdf8e (patch) | |
tree | 3de0d1f851abe79b0350f430cedd10ed776d1d10 /source/blender/windowmanager/gizmo | |
parent | c8bcddedff54442555a28879f506d3ffcf331fd6 (diff) |
Fix T63112: Gizmos fail to restore last cursor
Diffstat (limited to 'source/blender/windowmanager/gizmo')
-rw-r--r-- | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c index f21baa21006..31c5e1fb94c 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c @@ -908,6 +908,7 @@ bool WM_gizmomap_cursor_set(const wmGizmoMap *gzmap, wmWindow *win) bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz, int part) { if ((gz != gzmap->gzmap_context.highlight) || (gz && part != gz->highlight_part)) { + const bool init_last_cursor = (gzmap->gzmap_context.highlight == NULL); if (gzmap->gzmap_context.highlight) { gzmap->gzmap_context.highlight->state &= ~WM_GIZMO_STATE_HIGHLIGHT; gzmap->gzmap_context.highlight->highlight_part = -1; @@ -918,11 +919,15 @@ bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz if (gz) { gz->state |= WM_GIZMO_STATE_HIGHLIGHT; gz->highlight_part = part; - gzmap->gzmap_context.last_cursor = -1; + if (init_last_cursor) { + gzmap->gzmap_context.last_cursor = -1; + } if (C && gz->type->cursor_get) { wmWindow *win = CTX_wm_window(C); - gzmap->gzmap_context.last_cursor = win->cursor; + if (init_last_cursor) { + gzmap->gzmap_context.last_cursor = win->cursor; + } WM_cursor_set(win, gz->type->cursor_get(gz)); } } @@ -931,6 +936,7 @@ bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz wmWindow *win = CTX_wm_window(C); WM_cursor_set(win, gzmap->gzmap_context.last_cursor); } + gzmap->gzmap_context.last_cursor = -1; } /* tag the region for redraw */ |