From cbfe522bb320cc98ebd30930c354fd4b31b2a753 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Jul 2018 17:16:10 +0200 Subject: [PATCH] Fix manipulator hiding cursor Manipulator highlight, then transform would hide the mouse cursor. --- .../manipulators/intern/wm_manipulator_intern.h | 2 ++ .../windowmanager/manipulators/intern/wm_manipulator_map.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h index a131c6c5069..ecf4ffd2ac4 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h @@ -114,6 +114,8 @@ struct wmManipulatorMap { /* cursor location at point of entering modal (see: WM_MANIPULATOR_GRAB_CURSOR) */ int event_xy[2]; short event_grabcursor; + /* until we have nice cursor push/pop API. */ + int last_cursor; } mmap_context; }; diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c index 7b06382b029..76668702bd1 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c @@ -861,17 +861,18 @@ bool wm_manipulatormap_highlight_set( if (mpr) { mpr->state |= WM_MANIPULATOR_STATE_HIGHLIGHT; mpr->highlight_part = part; + mmap->mmap_context.last_cursor = -1; if (C && mpr->type->cursor_get) { wmWindow *win = CTX_wm_window(C); - win->lastcursor = win->cursor; + mmap->mmap_context.last_cursor = win->cursor; WM_cursor_set(win, mpr->type->cursor_get(mpr)); } } else { - if (C) { + if (C && mmap->mmap_context.last_cursor != -1) { wmWindow *win = CTX_wm_window(C); - WM_cursor_set(win, win->lastcursor); + WM_cursor_set(win, mmap->mmap_context.last_cursor); } }