diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-28 09:11:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-28 09:11:23 +0300 |
commit | 5aeecc0a290160aa5f7d30ead9f637c380ea2342 (patch) | |
tree | dd3edbbb63e4617c6f9f200d7f118f48c857018a /source/blender | |
parent | f0d20198b290338a9f58392f98ee43957b0bad61 (diff) |
Fix fallback tools for the sequence editor
Only regions with gizmos were checking for fallback tools.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/screen/area.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 46 |
3 files changed, 24 insertions, 32 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 4309359bd91..80c14371c16 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1744,7 +1744,7 @@ static void ed_default_handlers( if (flag & ED_KEYMAP_TOOL) { if (flag & ED_KEYMAP_GIZMO) { WM_event_add_keymap_handler_dynamic( - ®ion->handlers, WM_event_get_keymap_from_toolsystem_fallback, area); + ®ion->handlers, WM_event_get_keymap_from_toolsystem_with_gizmos, area); } else { WM_event_add_keymap_handler_dynamic( diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 59e03f472f0..112d76a3e65 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -276,10 +276,10 @@ typedef void(wmEventHandler_KeymapDynamicFn)(wmWindowManager *wm, struct wmEventHandler_Keymap *handler, struct wmEventHandler_KeymapResult *km_result); -void WM_event_get_keymap_from_toolsystem_fallback(struct wmWindowManager *wm, - struct wmWindow *win, - struct wmEventHandler_Keymap *handler, - wmEventHandler_KeymapResult *km_result); +void WM_event_get_keymap_from_toolsystem_with_gizmos(struct wmWindowManager *wm, + struct wmWindow *win, + struct wmEventHandler_Keymap *handler, + wmEventHandler_KeymapResult *km_result); void WM_event_get_keymap_from_toolsystem(struct wmWindowManager *wm, struct wmWindow *win, struct wmEventHandler_Keymap *handler, diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a426841b49c..6092689138d 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -4009,10 +4009,12 @@ wmEventHandler_Keymap *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap * * Follow #wmEventHandler_KeymapDynamicFn signature. */ -void WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm, - wmWindow *win, - wmEventHandler_Keymap *handler, - wmEventHandler_KeymapResult *km_result) +void wm_event_get_keymap_from_toolsystem_ex(wmWindowManager *wm, + wmWindow *win, + wmEventHandler_Keymap *handler, + wmEventHandler_KeymapResult *km_result, + /* Extra arguments. */ + const bool with_gizmos) { memset(km_result, 0x0, sizeof(*km_result)); @@ -4045,7 +4047,8 @@ void WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm, if (tref_rt->flag & TOOLREF_FLAG_FALLBACK_KEYMAP) { add_keymap = true; } - if (tref_rt->gizmo_group[0] != '\0') { + + if (with_gizmos && (tref_rt->gizmo_group[0] != '\0')) { wmGizmoMap *gzmap = NULL; wmGizmoGroup *gzgroup = NULL; LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { @@ -4069,6 +4072,7 @@ void WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm, } } } + if (add_keymap) { keymap_id_list[keymap_id_list_len++] = tref_rt->keymap_fallback; } @@ -4096,32 +4100,20 @@ void WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm, } } +void WM_event_get_keymap_from_toolsystem_with_gizmos(wmWindowManager *wm, + wmWindow *win, + wmEventHandler_Keymap *handler, + wmEventHandler_KeymapResult *km_result) +{ + wm_event_get_keymap_from_toolsystem_ex(wm, win, handler, km_result, true); +} + void WM_event_get_keymap_from_toolsystem(wmWindowManager *wm, - wmWindow *UNUSED(win), + wmWindow *win, wmEventHandler_Keymap *handler, wmEventHandler_KeymapResult *km_result) { - memset(km_result, 0x0, sizeof(*km_result)); - - ScrArea *area = handler->dynamic.user_data; - handler->keymap_tool = NULL; - bToolRef_Runtime *tref_rt = area->runtime.tool ? area->runtime.tool->runtime : NULL; - if (tref_rt && tref_rt->keymap[0]) { - const char *keymap_id = tref_rt->keymap; - { - wmKeyMap *km = WM_keymap_list_find_spaceid_or_empty( - &wm->userconf->keymaps, keymap_id, area->spacetype, RGN_TYPE_WINDOW); - /* We shouldn't use keymaps from unrelated spaces. */ - if (km != NULL) { - handler->keymap_tool = area->runtime.tool; - km_result->keymaps[km_result->keymaps_len++] = km; - } - else { - printf( - "Keymap: '%s' not found for tool '%s'\n", tref_rt->keymap, area->runtime.tool->idname); - } - } - } + wm_event_get_keymap_from_toolsystem_ex(wm, win, handler, km_result, false); } struct wmEventHandler_Keymap *WM_event_add_keymap_handler_dynamic( |