WM: Fix secondary toolbar events being ignored

Error in recent workaround.
This commit is contained in:
Campbell Barton 2018-11-16 09:19:33 +11:00
parent 088be7eb2f
commit e0a30aef19
1 changed files with 8 additions and 9 deletions

View 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)