Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_event_system.c
| Show First 20 Lines • Show All 2,716 Lines • ▼ Show 20 Lines | #endif | ||||
| if (!BLI_listbase_is_empty(&wm->drags)) { | if (!BLI_listbase_is_empty(&wm->drags)) { | ||||
| /* does polls for drop regions and checks uibuts */ | /* does polls for drop regions and checks uibuts */ | ||||
| /* need to be here to make sure region context is true */ | /* need to be here to make sure region context is true */ | ||||
| if (ELEM(event->type, MOUSEMOVE, EVT_DROP) || ISKEYMODIFIER(event->type)) { | if (ELEM(event->type, MOUSEMOVE, EVT_DROP) || ISKEYMODIFIER(event->type)) { | ||||
| wm_drags_check_ops(C, event); | wm_drags_check_ops(C, event); | ||||
| } | } | ||||
| } | } | ||||
| /* -------------------------------------------------------------------- */ | |||||
| /* How to solve properly? | |||||
| * | |||||
| * Handlers are stored in each region, | |||||
| * however the tool-system swaps keymaps often and isn't stored | |||||
| * per region. | |||||
| * | |||||
| * Need to investigate how this could be done better. | |||||
| * We might need to add a more dynamic handler type that uses a callback | |||||
| * to fetch its current keymap. | |||||
| */ | |||||
| wmEventHandler sneaky_handler = {NULL}; | |||||
| if (ar->regiontype == RGN_TYPE_WINDOW) { | |||||
| WorkSpace *workspace = WM_window_get_active_workspace(win); | |||||
| if (workspace->tool_active_keymap[0] && | |||||
| workspace->tool_active_spacetype == sa->spacetype) | |||||
| { | |||||
| wmKeyMap *km = WM_keymap_find_all( | |||||
| C, workspace->tool_active_keymap, sa->spacetype, RGN_TYPE_WINDOW); | |||||
| if (km != NULL) { | |||||
| sneaky_handler.keymap = km; | |||||
| BLI_addhead(&ar->handlers, &sneaky_handler); | |||||
| } | |||||
| } | |||||
| } | |||||
| /* -------------------------------------------------------------------- */ | |||||
| action |= wm_handlers_do(C, event, &ar->handlers); | action |= wm_handlers_do(C, event, &ar->handlers); | ||||
| if (sneaky_handler.keymap) { | |||||
| BLI_remlink(&ar->handlers, &sneaky_handler); | |||||
| } | |||||
| /* fileread case (python), [#29489] */ | /* fileread case (python), [#29489] */ | ||||
| if (CTX_wm_window(C) == NULL) | if (CTX_wm_window(C) == NULL) | ||||
| return; | return; | ||||
| if (action & WM_HANDLER_BREAK) | if (action & WM_HANDLER_BREAK) | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,198 Lines • Show Last 20 Lines | |||||