Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_event_system.c
| Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | wmEvent *wm_event_add_ex(wmWindow *win, const wmEvent *event_to_add, const wmEvent *event_to_add_after) | ||||
| return event; | return event; | ||||
| } | } | ||||
| wmEvent *wm_event_add(wmWindow *win, const wmEvent *event_to_add) | wmEvent *wm_event_add(wmWindow *win, const wmEvent *event_to_add) | ||||
| { | { | ||||
| return wm_event_add_ex(win, event_to_add, NULL); | return wm_event_add_ex(win, event_to_add, NULL); | ||||
| } | } | ||||
| wmEvent *WM_event_add_simulate(wmWindow *win, const wmEvent *event_to_add) | |||||
| { | |||||
| if ((G.f & G_EVENT_SIMULATE) == 0) { | |||||
| BLI_assert(0); | |||||
| return NULL; | |||||
| } | |||||
| wmEvent *event = wm_event_add(win, event_to_add); | |||||
| win->eventstate->x = event->x; | |||||
| win->eventstate->y = event->y; | |||||
| return event; | |||||
| } | |||||
| void wm_event_free(wmEvent *event) | void wm_event_free(wmEvent *event) | ||||
| { | { | ||||
| if (event->customdata) { | if (event->customdata) { | ||||
| if (event->customdatafree) { | if (event->customdatafree) { | ||||
| /* note: pointer to listbase struct elsewhere */ | /* note: pointer to listbase struct elsewhere */ | ||||
| if (event->custom == EVT_DATA_DRAGDROP) { | if (event->custom == EVT_DATA_DRAGDROP) { | ||||
| ListBase *lb = event->customdata; | ListBase *lb = event->customdata; | ||||
| WM_drag_free_list(lb); | WM_drag_free_list(lb); | ||||
| ▲ Show 20 Lines • Show All 3,756 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* windows store own event queues, no bContext here */ | /* windows store own event queues, no bContext here */ | ||||
| /* time is in 1000s of seconds, from ghost */ | /* time is in 1000s of seconds, from ghost */ | ||||
| void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int UNUSED(time), void *customdata) | void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int UNUSED(time), void *customdata) | ||||
| { | { | ||||
| wmWindow *owin; | wmWindow *owin; | ||||
| if (UNLIKELY(G.f & G_EVENT_SIMULATE)) { | |||||
| return; | |||||
| } | |||||
| /* Having both, event and evt, can be highly confusing to work with, but is necessary for | /* Having both, event and evt, can be highly confusing to work with, but is necessary for | ||||
| * our current event system, so let's clear things up a bit: | * our current event system, so let's clear things up a bit: | ||||
| * - data added to event only will be handled immediately, but will not be copied to the next event | * - data added to event only will be handled immediately, but will not be copied to the next event | ||||
| * - data added to evt only stays, but is handled with the next event -> execution delay | * - data added to evt only stays, but is handled with the next event -> execution delay | ||||
| * - data added to event and evt stays and is handled immediately | * - data added to event and evt stays and is handled immediately | ||||
| */ | */ | ||||
| wmEvent event, *evt = win->eventstate; | wmEvent event, *evt = win->eventstate; | ||||
| ▲ Show 20 Lines • Show All 841 Lines • Show Last 20 Lines | |||||