Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_window.c
| Show First 20 Lines • Show All 1,157 Lines • ▼ Show 20 Lines | if (wt->sleep == 0) { | ||||
| wt->duration += wt->delta; | wt->duration += wt->delta; | ||||
| wt->ltime = time; | wt->ltime = time; | ||||
| wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep); | wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep); | ||||
| if (wt->event_type == TIMERJOBS) | if (wt->event_type == TIMERJOBS) | ||||
| wm_jobs_timer(C, wm, wt); | wm_jobs_timer(C, wm, wt); | ||||
| else if (wt->event_type == TIMERAUTOSAVE) | else if (wt->event_type == TIMERAUTOSAVE) | ||||
| wm_autosave_timer(C, wm, wt); | wm_autosave_timer(C, wm, wt); | ||||
| else if (wt->event_type == TIMERNOTIFIER) | |||||
| WM_main_add_notifier(GET_UINT_FROM_POINTER(wt->customdata), NULL); | |||||
| else if (win) { | else if (win) { | ||||
| wmEvent event; | wmEvent event; | ||||
| wm_event_init_from_window(win, &event); | wm_event_init_from_window(win, &event); | ||||
| event.type = wt->event_type; | event.type = wt->event_type; | ||||
| event.val = KM_NOTHING; | event.val = KM_NOTHING; | ||||
| event.keymodifier = 0; | event.keymodifier = 0; | ||||
| event.custom = EVT_DATA_TIMER; | event.custom = EVT_DATA_TIMER; | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep) | ||||
| wt->timestep = timestep; | wt->timestep = timestep; | ||||
| wt->win = win; | wt->win = win; | ||||
| BLI_addtail(&wm->timers, wt); | BLI_addtail(&wm->timers, wt); | ||||
| return wt; | return wt; | ||||
| } | } | ||||
| wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigned int type, double timestep) | |||||
| { | |||||
| wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer"); | |||||
| wt->event_type = TIMERNOTIFIER; | |||||
| wt->ltime = PIL_check_seconds_timer(); | |||||
| wt->ntime = wt->ltime + timestep; | |||||
| wt->stime = wt->ltime; | |||||
| wt->timestep = timestep; | |||||
| wt->win = win; | |||||
| wt->customdata = SET_UINT_IN_POINTER(type); | |||||
| BLI_addtail(&wm->timers, wt); | |||||
| return wt; | |||||
| } | |||||
| void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer) | void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer) | ||||
| { | { | ||||
| wmTimer *wt; | wmTimer *wt; | ||||
| /* extra security check */ | /* extra security check */ | ||||
| for (wt = wm->timers.first; wt; wt = wt->next) | for (wt = wm->timers.first; wt; wt = wt->next) | ||||
| if (wt == timer) | if (wt == timer) | ||||
| break; | break; | ||||
| Show All 16 Lines | for (win = wm->windows.first; win; win = win->next) { | ||||
| event->customdata = NULL; | event->customdata = NULL; | ||||
| event->type = EVENT_NONE; /* timer users customdata, dont want NULL == NULL */ | event->type = EVENT_NONE; /* timer users customdata, dont want NULL == NULL */ | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void WM_event_remove_timer_notifier(wmWindowManager *wm, wmWindow *win, wmTimer *timer) | |||||
| { | |||||
| timer->customdata = NULL; | |||||
| WM_event_remove_timer(wm, win, timer); | |||||
| } | |||||
| /* ******************* clipboard **************** */ | /* ******************* clipboard **************** */ | ||||
| static char *wm_clipboard_text_get_ex(bool selection, int *r_len, | static char *wm_clipboard_text_get_ex(bool selection, int *r_len, | ||||
| bool firstline) | bool firstline) | ||||
| { | { | ||||
| char *p, *p2, *buf, *newbuf; | char *p, *p2, *buf, *newbuf; | ||||
| if (G.background) { | if (G.background) { | ||||
| ▲ Show 20 Lines • Show All 261 Lines • Show Last 20 Lines | |||||