From 29bee35112bcbcdbd40b37f6ddf33a785967602c Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 22 Jan 2011 18:00:11 +0000 Subject: [PATCH] Small fix from the todo: "Modal cursors" now remain visible, until reset. These cursors were reset already on edges. Example: 3d view toolbar, grease pencil. Do note, only use WM_cursor_modal() on real modal tools, and restore it at end. --- source/blender/makesdna/DNA_windowmanager_types.h | 5 +++-- source/blender/windowmanager/intern/wm_cursors.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index a29ea4e9152..f47ea06645b 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -169,9 +169,10 @@ typedef struct wmWindow { short monitor; /* multiscreen... no idea how to store yet */ short active; /* set to 1 if an active window, for quick rejects */ short cursor; /* current mouse cursor type */ - short lastcursor; /* for temp waitcursor */ + short lastcursor; /* previous cursor when setting modal one */ + short modalcursor; /* the current modal cursor */ short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */ - short pad2[2]; + short pad2; struct wmEvent *eventstate; /* storage for event system */ diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 6034ddce1b5..f0a416e1c6e 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -116,6 +116,9 @@ void WM_cursor_set(wmWindow *win, int curs) GHOST_SetCursorVisibility(win->ghostwin, 1); + if(curs == CURSOR_STD && win->modalcursor) + curs= win->modalcursor; + win->cursor= curs; /* detect if we use system cursor or Blender cursor */ @@ -141,11 +144,13 @@ void WM_cursor_modal(wmWindow *win, int val) { if(win->lastcursor == 0) win->lastcursor = win->cursor; + win->modalcursor = val; WM_cursor_set(win, val); } void WM_cursor_restore(wmWindow *win) { + win->modalcursor = 0; if(win->lastcursor) WM_cursor_set(win, win->lastcursor); win->lastcursor = 0;