diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-23 07:20:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-23 07:27:28 +0300 |
commit | f417a717b1d9c576276bee12c4646a97005a35bf (patch) | |
tree | 957d49f0826f94e2845918a7f6d9694d2bfa9b05 | |
parent | 1fef2d2b8df01ff75389b55f7bb2ae87fc35472d (diff) |
Gizmo: highlighted gizmo now handles all events first
Only mouse events were handled by the highlighted gizmo,
this allows more flexibility with event handling.
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 0208ff14e9b..07d5f4b0d59 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2732,22 +2732,19 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers } } else { - /* Either we operate on a single highlighted item - * or groups attached to the selected gizmos. */ + /* Handle highlight gizmo. */ + if (gz != NULL) { + wmGizmoGroup *gzgroup = gz->parent_gzgroup; + wmKeyMap *keymap = WM_keymap_active(wm, gzgroup->type->keymap); + action |= wm_handlers_do_keymap_with_gizmo_handler( + C, event, handlers, handler, gzgroup, keymap, do_debug_handler); + } - wmGizmoGroup *gzgroup_highlight = gz ? gz->parent_gzgroup : NULL; /* Don't use from now on. */ gz = NULL; - if (ISMOUSE(event->type)) { - if (gzgroup_highlight) { - wmGizmoGroup *gzgroup = gzgroup_highlight; - wmKeyMap *keymap = WM_keymap_active(wm, gzgroup->type->keymap); - action |= wm_handlers_do_keymap_with_gizmo_handler( - C, event, handlers, handler, gzgroup, keymap, do_debug_handler); - } - } - else { + /* Fallback to selected gizmo (when un-handled). */ + if ((action & WM_HANDLER_BREAK) == 0) { if (WM_gizmomap_is_any_selected(gzmap)) { const ListBase *groups = WM_gizmomap_group_list(gzmap); for (wmGizmoGroup *gzgroup = groups->first; gzgroup; gzgroup = gzgroup->next) { |