Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_event_system.c
| Show All 33 Lines | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "DNA_listBase.h" | #include "DNA_listBase.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_windowmanager_types.h" | #include "DNA_windowmanager_types.h" | ||||
| #include "DNA_workspace_types.h" | |||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "GHOST_C-api.h" | #include "GHOST_C-api.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_dynstr.h" | #include "BLI_dynstr.h" | ||||
| Show All 21 Lines | |||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "PIL_time.h" | #include "PIL_time.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "WM_message.h" | |||||
| #include "wm.h" | #include "wm.h" | ||||
| #include "wm_window.h" | #include "wm_window.h" | ||||
| #include "wm_event_system.h" | #include "wm_event_system.h" | ||||
| #include "wm_event_types.h" | #include "wm_event_types.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| ▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | |||||
| void wm_event_do_notifiers(bContext *C) | void wm_event_do_notifiers(bContext *C) | ||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| wmNotifier *note, *next; | wmNotifier *note, *next; | ||||
| wmWindow *win; | wmWindow *win; | ||||
| if (wm == NULL) | if (wm == NULL) | ||||
| return; | return; | ||||
| // disable | |||||
| if (0) { | |||||
| /* cache & catch WM level notifiers, such as frame change, scene/screen set */ | /* cache & catch WM level notifiers, such as frame change, scene/screen set */ | ||||
| for (win = wm->windows.first; win; win = win->next) { | for (win = wm->windows.first; win; win = win->next) { | ||||
| Scene *scene = WM_window_get_active_scene(win); | Scene *scene = WM_window_get_active_scene(win); | ||||
| bool do_anim = false; | bool do_anim = false; | ||||
| 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) { | ||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | for (win = wm->windows.first; win; win = win->next) { | ||||
| ED_region_do_listen(screen, sa, ar, note, scene); | ED_region_do_listen(screen, sa, ar, note, scene); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| MEM_freeN(note); | MEM_freeN(note); | ||||
| } | } | ||||
| } // disable | |||||
| { | |||||
| for (win = wm->windows.first; win; win = win->next) { | |||||
| CTX_wm_window_set(C, win); | |||||
| WorkSpace *workspace = WM_window_get_active_workspace(win); | |||||
| WM_msgbus_handle(workspace->message_bus, C); | |||||
| } | |||||
| CTX_wm_window_set(C, NULL); | |||||
| } | |||||
| wm_event_do_refresh_wm_and_depsgraph(C); | wm_event_do_refresh_wm_and_depsgraph(C); | ||||
| } | } | ||||
| 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) || (event->type == WINDEACTIVATE); | ||||
| ▲ Show 20 Lines • Show All 2,128 Lines • ▼ Show 20 Lines | for (win = wm->windows.first; win; win = win->next) { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| wmEvent *event; | wmEvent *event; | ||||
| /* some safty checks - these should always be set! */ | /* some safty checks - these should always be set! */ | ||||
| BLI_assert(WM_window_get_active_scene(win)); | BLI_assert(WM_window_get_active_scene(win)); | ||||
| BLI_assert(WM_window_get_active_screen(win)); | BLI_assert(WM_window_get_active_screen(win)); | ||||
| BLI_assert(WM_window_get_active_workspace(win)); | BLI_assert(WM_window_get_active_workspace(win)); | ||||
| { | |||||
| WorkSpace *workspace = WM_window_get_active_workspace(win); | |||||
| if (workspace->message_bus == NULL) { | |||||
| workspace->message_bus = WM_msgbus_create(); | |||||
| } | |||||
| } | |||||
| if (screen == NULL) | if (screen == NULL) | ||||
| wm_event_free_all(win); | wm_event_free_all(win); | ||||
| else { | else { | ||||
| Scene *scene = WM_window_get_active_scene(win); | Scene *scene = WM_window_get_active_scene(win); | ||||
| if (scene) { | if (scene) { | ||||
| int is_playing_sound = BKE_sound_scene_playing(scene); | int is_playing_sound = BKE_sound_scene_playing(scene); | ||||
| ▲ Show 20 Lines • Show All 1,371 Lines • Show Last 20 Lines | |||||