[Bf-blender-cvs] [ddb958ae998] master: Cleanup: remove hack that set operator id in the wmEvent

Campbell Barton noreply at git.blender.org
Mon Jan 13 05:07:18 CET 2020


Commit: ddb958ae998c1fc1a6bfb068e8dd545ebf6ed160
Author: Campbell Barton
Date:   Mon Jan 13 14:58:21 2020 +1100
Branches: master
https://developer.blender.org/rBddb958ae998c1fc1a6bfb068e8dd545ebf6ed160

Cleanup: remove hack that set operator id in the wmEvent

This can be replaced by passing an argument.

===================================================================

M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_event_query.c
M	source/blender/windowmanager/intern/wm_event_system.c

===================================================================

diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 0c3a5f92113..e9e4b7c6d12 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -548,9 +548,6 @@ typedef struct wmEvent {
   char check_drag;
   char is_motion_absolute;
 
-  /** Keymap item, set by handler (weak?). */
-  const char *keymap_idname;
-
   /** Tablet info, only use when the tablet is active. */
   const struct wmTabletData *tablet_data;
 
diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c
index e37f3b946fe..86d92a473ff 100644
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@ -68,7 +68,7 @@ void WM_event_print(const wmEvent *event)
     printf(
         "wmEvent  type:%d / %s, val:%d / %s,\n"
         "         shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d,\n"
-        "         mouse:(%d,%d), ascii:'%c', utf8:'%.*s', keymap_idname:%s, pointer:%p\n",
+        "         mouse:(%d,%d), ascii:'%c', utf8:'%.*s', pointer:%p\n",
         event->type,
         type_id,
         event->val,
@@ -83,7 +83,6 @@ void WM_event_print(const wmEvent *event)
         event->ascii,
         BLI_str_utf8_size(event->utf8_buf),
         event->utf8_buf,
-        event->keymap_idname,
         (const void *)event);
 
 #ifdef WITH_INPUT_NDOF
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 52acf026f3b..eebef43c0f6 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1966,7 +1966,8 @@ static int wm_handler_operator_call(bContext *C,
                                     ListBase *handlers,
                                     wmEventHandler *handler_base,
                                     wmEvent *event,
-                                    PointerRNA *properties)
+                                    PointerRNA *properties,
+                                    const char *kmi_idname)
 {
   int retval = OPERATOR_PASS_THROUGH;
 
@@ -2068,7 +2069,7 @@ static int wm_handler_operator_call(bContext *C,
     }
   }
   else {
-    wmOperatorType *ot = WM_operatortype_find(event->keymap_idname, 0);
+    wmOperatorType *ot = WM_operatortype_find(kmi_idname, 0);
 
     if (ot && wm_operator_check_locked_interface(C, ot)) {
       bool use_last_properties = true;
@@ -2406,10 +2407,8 @@ static int wm_handlers_do_keymap_with_keymap_handler(
 
           PRINT("%s:     item matched '%s'\n", __func__, kmi->idname);
 
-          /* weak, but allows interactive callback to not use rawkey */
-          event->keymap_idname = kmi->idname;
-
-          action |= wm_handler_operator_call(C, handlers, &handler->head, event, kmi->ptr);
+          action |= wm_handler_operator_call(
+              C, handlers, &handler->head, event, kmi->ptr, kmi->idname);
 
           if (action & WM_HANDLER_BREAK) {
             /* not always_pass here, it denotes removed handler_base */
@@ -2463,13 +2462,11 @@ static int wm_handlers_do_keymap_with_gizmo_handler(
       if (wm_eventmatch(event, kmi)) {
         PRINT("%s:     item matched '%s'\n", __func__, kmi->idname);
 
-        /* weak, but allows interactive callback to not use rawkey */
-        event->keymap_idname = kmi->idname;
-
         CTX_wm_gizmo_group_set(C, gzgroup);
 
         /* handler->op is called later, we want keymap op to be triggered here */
-        action |= wm_handler_operator_call(C, handlers, &handler->head, event, kmi->ptr);
+        action |= wm_handler_operator_call(
+            C, handlers, &handler->head, event, kmi->ptr, kmi->idname);
 
         CTX_wm_gizmo_group_set(C, NULL);
 
@@ -2760,7 +2757,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
           }
         }
         else {
-          action |= wm_handler_operator_call(C, handlers, handler_base, event, NULL);
+          action |= wm_handler_operator_call(C, handlers, handler_base, event, NULL, NULL);
         }
       }
       else {



More information about the Bf-blender-cvs mailing list