Fix T55178: Cursor fails to restore on cancel
574c0fe38f
caused complications
restoring the cursor.
Use WM_cursor_modal_set/restore which is intended for operator use,
calling ED_region_cursor_set after an operator runs isn't reliable.
This commit is contained in:
parent
c1361d2651
commit
39aea50155
Notes:
blender-bot
2023-02-14 10:21:15 +01:00
Referenced by issue #55178, Cursor icon doesn't change back when you right-click to undo
|
@ -601,6 +601,8 @@ typedef struct TransInfo {
|
|||
/** #TransInfo.center has been set, don't change it. */
|
||||
#define T_OVERRIDE_CENTER (1 << 25)
|
||||
|
||||
#define T_MODAL_CURSOR_SET (1 << 26)
|
||||
|
||||
/* TransInfo->modifiers */
|
||||
#define MOD_CONSTRAINT_SELECT 0x01
|
||||
#define MOD_PRECISION 0x02
|
||||
|
|
|
@ -1629,6 +1629,10 @@ void postTrans(bContext *C, TransInfo *t)
|
|||
if (t->draw_handle_cursor)
|
||||
WM_paint_cursor_end(CTX_wm_manager(C), t->draw_handle_cursor);
|
||||
|
||||
if (t->flag & T_MODAL_CURSOR_SET) {
|
||||
WM_cursor_modal_restore(CTX_wm_window(C));
|
||||
}
|
||||
|
||||
/* Free all custom-data */
|
||||
freeTransCustomDataContainer(t, NULL, &t->custom);
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
|
|
|
@ -351,7 +351,8 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
|
|||
case HLP_NONE:
|
||||
/* INPUT_VECTOR, INPUT_CUSTOM_RATIO, INPUT_CUSTOM_RATIO_FLIP */
|
||||
if (t->flag & T_MODAL) {
|
||||
WM_cursor_set(win, BC_NSEW_SCROLLCURSOR);
|
||||
t->flag |= T_MODAL_CURSOR_SET;
|
||||
WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR);
|
||||
}
|
||||
break;
|
||||
case HLP_SPRING:
|
||||
|
@ -360,7 +361,8 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
|
|||
case HLP_HARROW:
|
||||
case HLP_VARROW:
|
||||
if (t->flag & T_MODAL) {
|
||||
WM_cursor_set(win, CURSOR_NONE);
|
||||
t->flag |= T_MODAL_CURSOR_SET;
|
||||
WM_cursor_modal_set(win, CURSOR_NONE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1958,14 +1958,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
|
|||
|
||||
/* remove modal handler, operator itself should have been canceled and freed */
|
||||
if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
|
||||
/* set cursor back to the default for the region */
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
WM_cursor_grab_disable(win, NULL);
|
||||
/* Causes crash when joining areas: T55166, seems this is not even needed. */
|
||||
#if 0
|
||||
ED_region_cursor_set(win, area, region);
|
||||
#endif
|
||||
|
||||
WM_cursor_grab_disable(CTX_wm_window(C), NULL);
|
||||
|
||||
BLI_remlink(handlers, handler);
|
||||
wm_event_free_handler(handler);
|
||||
|
|
Loading…
Reference in New Issue