diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-03-16 21:11:39 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-03-16 21:11:39 +0000 |
| commit | f8a47de5ec444c452093371e3db16857eb39a490 (patch) | |
| tree | 31db2567842d98232775f9980f7a8d2586c0ac71 /openbox/timer.h | |
| parent | 8ba0586bcbdc7fe9648f1063812126d71a041670 (diff) | |
merge the C branch into HEAD
Diffstat (limited to 'openbox/timer.h')
| -rw-r--r-- | openbox/timer.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/openbox/timer.h b/openbox/timer.h new file mode 100644 index 00000000..da6c8642 --- /dev/null +++ b/openbox/timer.h @@ -0,0 +1,38 @@ +#ifndef __timer_h +#define __timer_h + +#include <glib.h> + +/*! Data type of Timer callback */ +typedef void (*TimeoutHandler)(void *data); + +typedef struct Timer { + /*! Milliseconds between timer firings */ + long delay; + /*! Callback for timer expiry */ + TimeoutHandler action; + /*! Data sent to callback */ + void *data; + /*! We overload the delete operator to just set this to true */ + gboolean del_me; + /*! The time the last fire should've been at */ + GTimeVal last; + /*! When this timer will next trigger */ + GTimeVal timeout; +} Timer; + +/*! Initializes the timer subsection */ +void timer_startup(); +/*! Destroys the timer subsection */ +void timer_shutdown(); + +/* Creates a new timer with a given delay */ +Timer *timer_start(long delay, TimeoutHandler cb, void *data); +/* Stops and frees a timer */ +void timer_stop(Timer *self); + +/*! Dispatch all pending timers. Sets wait to the amount of time to wait for + the next timer, or NULL if there are no timers to wait for */ +void timer_dispatch(GTimeVal **wait); + +#endif |
