[Bf-blender-cvs] [cbfe522bb32] blender2.8: Fix manipulator hiding cursor

Campbell Barton noreply at git.blender.org
Wed Jul 11 17:19:02 CEST 2018


Commit: cbfe522bb320cc98ebd30930c354fd4b31b2a753
Author: Campbell Barton
Date:   Wed Jul 11 17:16:10 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcbfe522bb320cc98ebd30930c354fd4b31b2a753

Fix manipulator hiding cursor

Manipulator highlight, then transform would hide the mouse cursor.

===================================================================

M	source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
M	source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c

===================================================================

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);
 			}
 		}



More information about the Bf-blender-cvs mailing list