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