Fix #139681: Cursor appears in walk navigation after hovering over gizmo

Regression in [0] which would re-highlight gizmos when they had been
tagged for highlighting.

This caused highlighting to be recalculated unexpectedly while
blocking modal operators run that used a timer.

The timer events would be passed though to the gizmo handler which
then re-evaluated the highlighted gizmo based on the cursor position.

Resolve by skipping pass-through for gizmos.

[0]: f839847d3b4849425c3b06a52aae4361d384fea4
This commit is contained in:
Campbell Barton
2025-06-04 13:54:32 +10:00
parent b20b2688ad
commit 534044ccef

View File

@@ -3199,9 +3199,31 @@ static eHandlerActionFlag wm_handlers_do_gizmo_handler(bContext *C,
wmWindowManager *wm,
wmEventHandler_Gizmo *handler,
wmEvent *event,
const bool always_pass,
ListBase *handlers,
const bool do_debug_handler)
{
eHandlerActionFlag action = WM_HANDLER_CONTINUE;
/* NOTE(@ideasman42): early exit for always-pass events (typically timers)
* which pass through from running modal operators which may have started them.
* In the case of blocking modal operators, it's not expected that gizmos would
* be used at the same time as navigating or painting for example.
*
* In principle these could be handled, however in practice:
* `handle_highlight` & `handle_keymap` would be set to false for timers,
* making this function do practically nothing.
*
* Early exit to avoid complicating checks below.
* The early return can be replaced with checks that only run
* necessary logic if these events need to be handled in the future.
*
* Without this, gizmos can become highlighted and the cursor changed
* while navigating in the 3D viewport, see: #139681. */
if (always_pass) {
return action;
}
/* Drag events use the previous click location to highlight the gizmos,
* Get the highlight again in case the user dragged off the gizmo. */
const bool is_event_drag = (event->val == KM_CLICK_DRAG);
@@ -3211,7 +3233,6 @@ static eHandlerActionFlag wm_handlers_do_gizmo_handler(bContext *C,
* was initiated over a gizmo. */
const bool restore_highlight_unless_activated = is_event_drag;
eHandlerActionFlag action = WM_HANDLER_CONTINUE;
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
wmGizmoMap *gzmap = handler->gizmo_map;
@@ -3532,7 +3553,8 @@ static eHandlerActionFlag wm_handlers_do_intern(bContext *C,
}
else if (handler_base->type == WM_HANDLER_TYPE_GIZMO) {
wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base;
action |= wm_handlers_do_gizmo_handler(C, wm, handler, event, handlers, do_debug_handler);
action |= wm_handlers_do_gizmo_handler(
C, wm, handler, event, always_pass, handlers, do_debug_handler);
}
else if (handler_base->type == WM_HANDLER_TYPE_OP) {
wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;