WM: Fix secondary toolbar events being ignored
authorCampbell Barton <ideasman42@gmail.com>
Thu, 15 Nov 2018 22:19:33 +0000 (09:19 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 15 Nov 2018 22:19:33 +0000 (09:19 +1100)
Error in recent workaround.

release/scripts/startup/bl_operators/wm.py

index a45013583d6cfebe2320d5ba88c58be143ee6ece..c770746666db27ef9a22feb2864ada6649e2b9a0 100644 (file)
@@ -2393,9 +2393,9 @@ class WM_OT_tool_set_by_name(Operator):
             if not self.properties.is_property_set("name"):
                 WM_OT_toolbar._key_held = False
                 return {'PASS_THROUGH'}
-            elif WM_OT_toolbar._key_held and event.value != 'RELEASE':
+            elif (WM_OT_toolbar._key_held == event.type) and (event.value != 'RELEASE'):
                 return {'PASS_THROUGH'}
-            WM_OT_toolbar._key_held = False
+            WM_OT_toolbar._key_held = None
 
             return self.execute(context)
 
@@ -2422,13 +2422,16 @@ class WM_OT_toolbar(Operator):
     bl_idname = "wm.toolbar"
     bl_label = "Toolbar"
 
-    if use_toolbar_release_hack:
-        _key_held = False
-
     @classmethod
     def poll(cls, context):
         return context.space_data is not None
 
+    if use_toolbar_release_hack:
+        _key_held = None
+        def invoke(self, context, event):
+            WM_OT_toolbar._key_held = event.type
+            return self.execute(context)
+
     def execute(self, context):
         from bl_ui.space_toolsystem_common import (
             ToolSelectPanelHelper,
@@ -2444,10 +2447,6 @@ class WM_OT_toolbar(Operator):
         keymap = keymap_from_context(context, space_type)
 
         def draw_menu(popover, context):
-            if use_toolbar_release_hack:
-                # Release event sets false.
-                WM_OT_toolbar._key_held = True
-
             layout = popover.layout
             layout.operator_context = 'INVOKE_REGION_WIN'
             cls.draw_cls(layout, context, detect_layout=False, scale_y=1.0)