Fix toolbar popup outside the window region

This commit is contained in:
2018-09-03 10:19:30 +10:00
parent 41f4d21079
commit 4893b8c693
2 changed files with 7 additions and 2 deletions

View File

@@ -2407,7 +2407,7 @@ class WM_OT_toolbar(Operator):
def draw_menu(popover, context): def draw_menu(popover, context):
layout = popover.layout layout = popover.layout
layout.operator_context = 'INVOKE_DEFAULT' layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("wm.search_menu", text="Search Commands...", icon='VIEWZOOM') layout.operator("wm.search_menu", text="Search Commands...", icon='VIEWZOOM')
cls.draw_cls(layout, context, detect_layout=False, scale_y=1.0) cls.draw_cls(layout, context, detect_layout=False, scale_y=1.0)

View File

@@ -740,12 +740,14 @@ def keymap_from_context(context, space_type):
if item.operator is not None: if item.operator is not None:
kmi_found = wm.keyconfigs.find_item_from_operator( kmi_found = wm.keyconfigs.find_item_from_operator(
idname=item.operator, idname=item.operator,
context='INVOKE_REGION_WIN',
)[1] )[1]
elif item.keymap is not None: elif item.keymap is not None:
kmi_first = item.keymap[0].keymap_items[0] kmi_first = item.keymap[0].keymap_items[0]
kmi_found = wm.keyconfigs.find_item_from_operator( kmi_found = wm.keyconfigs.find_item_from_operator(
idname=kmi_first.idname, idname=kmi_first.idname,
# properties=kmi_first.properties, # prevents matches, don't use. # properties=kmi_first.properties, # prevents matches, don't use.
context='INVOKE_REGION_WIN',
)[1] )[1]
del kmi_first del kmi_first
else: else:
@@ -863,7 +865,10 @@ def keymap_from_context(context, space_type):
if True: if True:
# The shortcut will show, so we better support running it. # The shortcut will show, so we better support running it.
kmi_search = wm.keyconfigs.find_item_from_operator(idname="wm.search_menu")[1] kmi_search = wm.keyconfigs.find_item_from_operator(
idname="wm.search_menu",
context='INVOKE_REGION_WIN',
)[1]
if kmi_search: if kmi_search:
keymap.keymap_items.new( keymap.keymap_items.new(
"wm.search_menu", "wm.search_menu",