diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-09 09:39:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-09 09:39:09 +0300 |
commit | 32396b316455c5b207b1103f03ddc4c8e81cfd00 (patch) | |
tree | 0ddd42d9674668a85e13e28a2c588fc5935d52d8 /source/blender/windowmanager/intern/wm_event_system.c | |
parent | ac8aff2b28e93500d596a1fcdc2aa5089d4377c2 (diff) |
WM: support for filtering modal keymap items
Modal keymap display often shows items which aren't used,
add a poll funciton to hide these from the status bar.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 4f5578e452d..7e2198eed7a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -4524,14 +4524,14 @@ bool WM_window_modal_keymap_status_draw( uiLayout *layout) { wmKeyMap *keymap = NULL; - wmOperatorType *ot = NULL; + wmOperator *op = NULL; for (wmEventHandler *handler = win->modalhandlers.first; handler; handler = handler->next) { if (handler->op) { /* 'handler->keymap' could be checked too, seems not to be used. */ wmKeyMap *keymap_test = handler->op->type->modalkeymap; if (keymap_test && keymap_test->modal_items) { keymap = keymap_test; - ot = handler->op->type; + op = handler->op; break; } } @@ -4546,6 +4546,11 @@ bool WM_window_modal_keymap_status_draw( if (!items[i].identifier[0]) { continue; } + if ((keymap->poll_modal_item != NULL) && + (keymap->poll_modal_item(op, items[i].value) == false)) + { + continue; + } bool show_text = true; @@ -4577,7 +4582,8 @@ bool WM_window_modal_keymap_status_draw( char buf[UI_MAX_DRAW_STR]; int available_len = sizeof(buf); char *p = buf; - WM_modalkeymap_operator_items_to_string_buf(ot, items[i].value, true, UI_MAX_SHORTCUT_STR, &available_len, &p); + WM_modalkeymap_operator_items_to_string_buf( + op->type, items[i].value, true, UI_MAX_SHORTCUT_STR, &available_len, &p); p -= 1; if (p > buf) { BLI_snprintf(p, available_len, ": %s", items[i].name); |