Gizmo: highlighted gizmo now handles all events first
authorCampbell Barton <ideasman42@gmail.com>
Thu, 23 May 2019 04:20:33 +0000 (14:20 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 23 May 2019 04:27:28 +0000 (14:27 +1000)
Only mouse events were handled by the highlighted gizmo,
this allows more flexibility with event handling.

source/blender/windowmanager/intern/wm_event_system.c

index 0208ff1..07d5f4b 100644 (file)
@@ -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) {