diff options
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 35 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 24 |
2 files changed, 46 insertions, 13 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 7e7dfe7a968..685e671c31a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -48,6 +48,7 @@ #include "BKE_main.h" #include "BKE_report.h" #include "BKE_scene.h" +#include "BKE_screen.h" #include "BKE_utildefines.h" #include "ED_fileselect.h" @@ -656,17 +657,37 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, int contex case WM_OP_EXEC_REGION_WIN: case WM_OP_INVOKE_REGION_WIN: + case WM_OP_EXEC_REGION_CHANNELS: + case WM_OP_INVOKE_REGION_CHANNELS: + case WM_OP_EXEC_REGION_PREVIEW: + case WM_OP_INVOKE_REGION_PREVIEW: { - /* forces operator to go to the region window, for header menus - but we stay in the same region if we are already in one */ + /* forces operator to go to the region window/channels/preview, for header menus + * but we stay in the same region if we are already in one + */ ARegion *ar= CTX_wm_region(C); ScrArea *area= CTX_wm_area(C); + int type = RGN_TYPE_WINDOW; - if(!(ar && ar->regiontype == RGN_TYPE_WINDOW) && area) { - ARegion *ar1= area->regionbase.first; - for(; ar1; ar1= ar1->next) - if(ar1->regiontype==RGN_TYPE_WINDOW) - break; + switch (context) { + case WM_OP_EXEC_REGION_CHANNELS: + case WM_OP_INVOKE_REGION_CHANNELS: + type = RGN_TYPE_CHANNELS; + + case WM_OP_EXEC_REGION_PREVIEW: + case WM_OP_INVOKE_REGION_PREVIEW: + type = RGN_TYPE_PREVIEW; + break; + + case WM_OP_EXEC_REGION_WIN: + case WM_OP_INVOKE_REGION_WIN: + default: + type = RGN_TYPE_WINDOW; + break; + } + + if(!(ar && ar->regiontype == type) && area) { + ARegion *ar1= BKE_area_find_region_type(area, type); if(ar1) CTX_wm_region_set(C, ar1); } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 9b0f6823522..e0d4cf13efd 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -43,6 +43,7 @@ #include "BKE_idprop.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_screen.h" #include "BKE_utildefines.h" #include "RNA_access.h" @@ -475,16 +476,27 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *op if(found==NULL) { if(ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) { if(sa) { - if(!(ar && ar->regiontype == RGN_TYPE_WINDOW)) { - for(ar= sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_WINDOW) - break; - } - + if (!(ar && ar->regiontype == RGN_TYPE_WINDOW)) + ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + if(ar) found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r); } } + else if(ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) { + if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS)) + ar= BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS); + + if(ar) + found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r); + } + else if(ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) { + if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW)) + ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); + + if(ar) + found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r); + } else { if(ar) found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r); |