]> icculus.org git repositories - dana/openbox.git/blob - openbox/timer.h
translate sendtodesktop actions
[dana/openbox.git] / openbox / timer.h
1 #ifndef __timer_h
2 #define __timer_h
3
4 #include <glib.h>
5
6 /*! Data type of Timer callback */
7 typedef void (*TimeoutHandler)(void *data);
8
9 typedef struct Timer {
10     /*! Milliseconds between timer firings */
11     long delay;
12     /*! Callback for timer expiry */
13     TimeoutHandler action;
14     /*! Data sent to callback */
15     void *data;
16     /*! We overload the delete operator to just set this to true */
17     gboolean del_me;
18     /*! The time the last fire should've been at */
19     GTimeVal last;
20     /*! When this timer will next trigger */
21     GTimeVal timeout;
22 } Timer;
23
24 /*! Initializes the timer subsection */
25 void timer_startup();
26 /*! Destroys the timer subsection */
27 void timer_shutdown();
28
29 /* Creates a new timer with a given delay */
30 Timer *timer_start(long delay, TimeoutHandler cb, void *data);
31 /* Stops and frees a timer */
32 void timer_stop(Timer *self);
33
34 /*! Dispatch all pending timers. Sets wait to the amount of time to wait for
35   the next timer, or NULL if there are no timers to wait for */
36 void timer_dispatch(GTimeVal **wait);
37
38 #endif