Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-26 16:29:47 +0300
committerTon Roosendaal <ton@blender.org>2008-12-26 16:29:47 +0300
commitbf956bb475c1f064020d3a951bb2ce051f5f7eea (patch)
tree450a87ee0c10875c2cd0867071c6e3619c9cca4d /source/blender/windowmanager
parent233509245615d06f0274d04940ad67d8e636d7f0 (diff)
2.5
Timers: added extra 'event type' argument to call to add a timer: WM_event_add_window_timer(win, event_type, interval) This way other timer systems don't generate overhead on the queues. (button timers were creating unused animation-playback operators)
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h4
-rw-r--r--source/blender/windowmanager/WM_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm_window.c11
-rw-r--r--source/blender/windowmanager/wm_event_types.h6
4 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 1fe9da8b06c..be1297880f6 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -99,8 +99,8 @@ void WM_event_add_notifier(struct bContext *C, int type, int value, void *data)
void wm_event_add (wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
- /* at maximum, every timestep seconds it triggers TIMER events */
-struct wmTimer *WM_event_add_window_timer(wmWindow *win, double timestep);
+ /* at maximum, every timestep seconds it triggers event_type events */
+struct wmTimer *WM_event_add_window_timer(wmWindow *win, int event_type, double timestep);
void WM_event_remove_window_timer(wmWindow *win, struct wmTimer *timer);
void WM_event_window_timer_sleep(wmWindow *win, struct wmTimer *timer, int dosleep);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 687a8a6628c..27a730f9dae 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -173,6 +173,7 @@ typedef struct wmTabletData {
typedef struct wmTimer {
struct wmTimer *next, *prev;
double timestep; /* set by timer user */
+ int event_type; /* set by timer user */
double duration; /* total running time in seconds */
double delta; /* time since previous step in seconds */
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 5773fd847c7..c12e7921e7f 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -517,11 +517,17 @@ static int wm_window_timer(const bContext *C)
for(wt= win->timers.first; wt; wt= wt->next) {
if(wt->sleep==0) {
if(wt->timestep < time - wt->ltime) {
+ wmEvent event= *(win->eventstate);
+
wt->delta= time - wt->ltime;
wt->duration += wt->delta;
wt->ltime= time;
- wm_event_add_ghostevent(win, GHOST_kEventTimer, wt);
+ event.type= wt->event_type;
+ event.custom= EVT_DATA_TIMER;
+ event.customdata= wt;
+ wm_event_add(win, &event);
+
retval= 1;
}
}
@@ -571,10 +577,11 @@ void WM_event_window_timer_sleep(wmWindow *win, wmTimer *timer, int dosleep)
}
}
-wmTimer *WM_event_add_window_timer(wmWindow *win, double timestep)
+wmTimer *WM_event_add_window_timer(wmWindow *win, int event_type, double timestep)
{
wmTimer *wt= MEM_callocN(sizeof(wmTimer), "window timer");
+ wt->event_type= event_type;
wt->ltime= PIL_check_seconds_timer();
wt->timestep= timestep;
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 6fc9aa86e12..91427579c29 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -67,7 +67,11 @@
#define WINCLOSE 0x0107 /* window close */
#define WINQUIT 0x0108 /* signal from user that app is to go away */
#define Q_FIRSTTIME 0x0109 /* on startup */
-#define TIMER 0x0110 /* timer event */
+
+#define TIMER 0x0110 /* timer event, passed on to all queues */
+#define TIMER0 0x0111 /* timer event, slot for internal use */
+#define TIMER1 0x0112 /* timer event, slot for internal use */
+#define TIMER2 0x0113 /* timer event, slot for internal use */
/* standard keyboard */