diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-02-04 14:06:21 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-02-04 22:56:07 +0300 |
commit | 36d09d9029c970de6a6c4d926fc1189865b145c3 (patch) | |
tree | c321241ec1582d1761d77de726297e92cecba81c /source | |
parent | f7ca86369da89a6726bc9edc9bf4e875b2b43c46 (diff) |
Fix T67084: Modal keymaps could show the wrong shortcut
WM_modalkeymap_operator_items_to_string() wasnt checking
WM_keymap_active(), so it was possible that e.g. when using the Industry
Compatible keymap, the shortcut from the Blender keymap was shown.
This also fixes the (now exposed) bug that the Industry Compatible keymap
would not have a ADD_CUT_CLOSED kmi defined for the Knife Tool [mandatory
for the status bar].
Maniphest Tasks: T67084
Differential Revision: https://developer.blender.org/D6748
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 104fbc84306..ddc7e325fab 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -5415,8 +5415,9 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) * * \{ */ -bool WM_window_modal_keymap_status_draw(bContext *UNUSED(C), wmWindow *win, uiLayout *layout) +bool WM_window_modal_keymap_status_draw(bContext *C, wmWindow *win, uiLayout *layout) { + wmWindowManager *wm = CTX_wm_manager(C); wmKeyMap *keymap = NULL; wmOperator *op = NULL; LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { @@ -5424,7 +5425,7 @@ bool WM_window_modal_keymap_status_draw(bContext *UNUSED(C), wmWindow *win, uiLa wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; if (handler->op != NULL) { /* 'handler->keymap' could be checked too, seems not to be used. */ - wmKeyMap *keymap_test = handler->op->type->modalkeymap; + wmKeyMap *keymap_test = WM_keymap_active(wm, handler->op->type->modalkeymap); if (keymap_test && keymap_test->modal_items) { keymap = keymap_test; op = handler->op; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 1809a233ce1..1587f7ab71d 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1295,7 +1295,9 @@ int WM_modalkeymap_operator_items_to_string(wmOperatorType *ot, char *result, const int result_len) { - return WM_modalkeymap_items_to_string(ot->modalkeymap, propvalue, compact, result, result_len); + wmWindowManager *wm = G_MAIN->wm.first; + wmKeyMap *keymap = WM_keymap_active(wm, ot->modalkeymap); + return WM_modalkeymap_items_to_string(keymap, propvalue, compact, result, result_len); } char *WM_modalkeymap_operator_items_to_string_buf(wmOperatorType *ot, |