Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_event_system.c
| Show First 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | for (win = wm->windows.first; win; win = win->next) { | ||||
| CTX_wm_window_set(C, win); | CTX_wm_window_set(C, win); | ||||
| for (note = wm->queue.first; note; note = next) { | for (note = wm->queue.first; note; note = next) { | ||||
| next = note->next; | next = note->next; | ||||
| if (note->category == NC_WM) { | if (note->category == NC_WM) { | ||||
| if (ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) { | if (ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) { | ||||
| wm->file_saved = 1; | wm->file_saved = 1; | ||||
| wm_window_title(wm, win); | wm_window_title(wm, win, NULL); | ||||
| } | } | ||||
| else if (note->data == ND_DATACHANGED) | else if (note->data == ND_DATACHANGED) | ||||
| wm_window_title(wm, win); | wm_window_title(wm, win, NULL); | ||||
| } | } | ||||
| if (note->window == win) { | if (note->window == win) { | ||||
| if (note->category == NC_SCREEN) { | if (note->category == NC_SCREEN) { | ||||
| if (note->data == ND_SCREENBROWSE) { | if (note->data == ND_SCREENBROWSE) { | ||||
| /* free popup handlers only [#35434] */ | /* free popup handlers only [#35434] */ | ||||
| UI_popup_handlers_remove_all(C, &win->modalhandlers); | UI_popup_handlers_remove_all(C, &win->modalhandlers); | ||||
| ▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | void wm_event_do_notifiers(bContext *C) | ||||
| } | } | ||||
| CTX_wm_window_set(C, NULL); | CTX_wm_window_set(C, NULL); | ||||
| } | } | ||||
| static int wm_event_always_pass(const wmEvent *event) | static int wm_event_always_pass(const wmEvent *event) | ||||
| { | { | ||||
| /* some events we always pass on, to ensure proper communication */ | /* some events we always pass on, to ensure proper communication */ | ||||
| return ISTIMER(event->type) || (event->type == WINDEACTIVATE); | return ISTIMER(event->type) || (ELEM(event->type, WINDEACTIVATE, EVT_HMD_TRANSFORM)); | ||||
| } | } | ||||
| /* ********************* ui handler ******************* */ | /* ********************* ui handler ******************* */ | ||||
| static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEvent *event, int always_pass) | static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEvent *event, int always_pass) | ||||
| { | { | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| ▲ Show 20 Lines • Show All 1,347 Lines • ▼ Show 20 Lines | |||||
| /* fileselect handlers are only in the window queue, so it's safe to switch screens or area types */ | /* fileselect handlers are only in the window queue, so it's safe to switch screens or area types */ | ||||
| static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHandler *handler, int val) | static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHandler *handler, int val) | ||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| SpaceFile *sfile; | SpaceFile *sfile; | ||||
| int action = WM_HANDLER_CONTINUE; | int action = WM_HANDLER_CONTINUE; | ||||
| if (val == EVT_FILESELECT_FULL_OPEN && !ED_screen_is_editable(CTX_wm_screen(C))) { | |||||
| val = EVT_FILESELECT_EXTERNAL_CANCEL; | |||||
| } | |||||
| switch (val) { | switch (val) { | ||||
| case EVT_FILESELECT_FULL_OPEN: | case EVT_FILESELECT_FULL_OPEN: | ||||
| { | { | ||||
| ScrArea *sa; | ScrArea *sa; | ||||
| /* sa can be null when window A is active, but mouse is over window B */ | /* sa can be null when window A is active, but mouse is over window B */ | ||||
| /* in this case, open file select in original window A */ | /* in this case, open file select in original window A */ | ||||
| if (handler->op_area == NULL) { | if (handler->op_area == NULL) { | ||||
| bScreen *screen = CTX_wm_screen(C); | bScreen *screen = CTX_wm_screen(C); | ||||
| sa = (ScrArea *)screen->areabase.first; | sa = (ScrArea *)screen->areabase.first; | ||||
| ▲ Show 20 Lines • Show All 352 Lines • ▼ Show 20 Lines | |||||
| static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) | static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) | ||||
| { | { | ||||
| int action = wm_handlers_do_intern(C, event, handlers); | int action = wm_handlers_do_intern(C, event, handlers); | ||||
| /* fileread case */ | /* fileread case */ | ||||
| if (CTX_wm_window(C) == NULL) | if (CTX_wm_window(C) == NULL) | ||||
| return action; | return action; | ||||
| if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE, EVENT_NONE) && !ISTIMER(event->type)) { | if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE, EVENT_NONE, EVT_HMD_TRANSFORM) && !ISTIMER(event->type)) { | ||||
| /* test for CLICK events */ | /* test for CLICK events */ | ||||
| if (wm_action_not_handled(action)) { | if (wm_action_not_handled(action)) { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| /* eventstate stores if previous event was a KM_PRESS, in case that | /* eventstate stores if previous event was a KM_PRESS, in case that | ||||
| * wasn't handled, the KM_RELEASE will become a KM_CLICK */ | * wasn't handled, the KM_RELEASE will become a KM_CLICK */ | ||||
| ▲ Show 20 Lines • Show All 1,333 Lines • ▼ Show 20 Lines | case GHOST_kEventNDOFButton: | ||||
| event.customdata = NULL; | event.customdata = NULL; | ||||
| wm_event_add(win, &event); | wm_event_add(win, &event); | ||||
| break; | break; | ||||
| } | } | ||||
| #endif /* WITH_INPUT_NDOF */ | #endif /* WITH_INPUT_NDOF */ | ||||
| #ifdef WITH_INPUT_HMD | |||||
| case GHOST_kEventHMD: | |||||
| { | |||||
| GHOST_TEventOpenHMDData *e = customdata; | |||||
| if (e->subtype == GHOST_kOrientationUpdate) { | |||||
| event.type = EVT_HMD_TRANSFORM; | |||||
| wm_event_add(win, &event); | |||||
| } | |||||
| break; | |||||
| } | |||||
| #endif /* WITH_INPUT_HMD */ | |||||
| case GHOST_kEventUnknown: | case GHOST_kEventUnknown: | ||||
| case GHOST_kNumEventTypes: | case GHOST_kNumEventTypes: | ||||
| break; | break; | ||||
| case GHOST_kEventWindowDeactivate: | case GHOST_kEventWindowDeactivate: | ||||
| { | { | ||||
| event.type = WINDEACTIVATE; | event.type = WINDEACTIVATE; | ||||
| wm_event_add(win, &event); | wm_event_add(win, &event); | ||||
| ▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines | |||||