prefix the Timer->ObTimer and TimeoutHandler->ObTimeoutHandler shitz
This commit is contained in:
parent
122d55fbad
commit
85112c4d08
7 changed files with 22 additions and 19 deletions
|
@ -518,7 +518,7 @@ void dock_hide(gboolean hide)
|
||||||
} else {
|
} else {
|
||||||
g_assert(!dock->hide_timer);
|
g_assert(!dock->hide_timer);
|
||||||
dock->hide_timer = timer_start(config_dock_hide_timeout * 1000,
|
dock->hide_timer = timer_start(config_dock_hide_timeout * 1000,
|
||||||
(TimeoutHandler)hide_timeout,
|
(ObTimeoutHandler)hide_timeout,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ struct _ObDock
|
||||||
gint h;
|
gint h;
|
||||||
|
|
||||||
gboolean hidden;
|
gboolean hidden;
|
||||||
Timer *hide_timer;
|
ObTimer *hide_timer;
|
||||||
|
|
||||||
GList *dock_apps;
|
GList *dock_apps;
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,7 @@ static Window support_window = None;
|
||||||
#ifdef USE_LIBSN
|
#ifdef USE_LIBSN
|
||||||
static SnMonitorContext *sn_context;
|
static SnMonitorContext *sn_context;
|
||||||
static int sn_busy_cnt;
|
static int sn_busy_cnt;
|
||||||
static Timer *sn_timer = NULL;
|
static ObTimer *sn_timer = NULL;
|
||||||
|
|
||||||
static void sn_event_func(SnMonitorEvent *event, void *data);
|
static void sn_event_func(SnMonitorEvent *event, void *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,7 +8,7 @@ static GTimeVal now;
|
||||||
static GTimeVal ret_wait;
|
static GTimeVal ret_wait;
|
||||||
static GSList *timers; /* nearest timer is at the top */
|
static GSList *timers; /* nearest timer is at the top */
|
||||||
|
|
||||||
#define NEAREST_TIMEOUT (((Timer*)timers->data)->timeout)
|
#define NEAREST_TIMEOUT (((ObTimer*)timers->data)->timeout)
|
||||||
|
|
||||||
static long timecompare(GTimeVal *a, GTimeVal *b)
|
static long timecompare(GTimeVal *a, GTimeVal *b)
|
||||||
{
|
{
|
||||||
|
@ -19,11 +19,11 @@ static long timecompare(GTimeVal *a, GTimeVal *b)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insert_timer(Timer *self)
|
static void insert_timer(ObTimer *self)
|
||||||
{
|
{
|
||||||
GSList *it;
|
GSList *it;
|
||||||
for (it = timers; it != NULL; it = it->next) {
|
for (it = timers; it != NULL; it = it->next) {
|
||||||
Timer *t = it->data;
|
ObTimer *t = it->data;
|
||||||
if (timecompare(&self->timeout, &t->timeout) <= 0) {
|
if (timecompare(&self->timeout, &t->timeout) <= 0) {
|
||||||
timers = g_slist_insert_before(timers, it, self);
|
timers = g_slist_insert_before(timers, it, self);
|
||||||
break;
|
break;
|
||||||
|
@ -49,9 +49,9 @@ void timer_shutdown()
|
||||||
timers = NULL;
|
timers = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer *timer_start(long delay, TimeoutHandler cb, void *data)
|
ObTimer *timer_start(long delay, ObTimeoutHandler cb, void *data)
|
||||||
{
|
{
|
||||||
Timer *self = g_new(Timer, 1);
|
ObTimer *self = g_new(ObTimer, 1);
|
||||||
self->delay = delay;
|
self->delay = delay;
|
||||||
self->action = cb;
|
self->action = cb;
|
||||||
self->data = data;
|
self->data = data;
|
||||||
|
@ -64,7 +64,7 @@ Timer *timer_start(long delay, TimeoutHandler cb, void *data)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_stop(Timer *self)
|
void timer_stop(ObTimer *self)
|
||||||
{
|
{
|
||||||
self->del_me = TRUE;
|
self->del_me = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void timer_dispatch(GTimeVal **wait)
|
||||||
g_get_current_time(&now);
|
g_get_current_time(&now);
|
||||||
|
|
||||||
while (timers != NULL) {
|
while (timers != NULL) {
|
||||||
Timer *curr = timers->data; /* get the top element */
|
ObTimer *curr = timers->data; /* get the top element */
|
||||||
/* since timer_stop doesn't actually free the timer, we have to do our
|
/* since timer_stop doesn't actually free the timer, we have to do our
|
||||||
real freeing in here.
|
real freeing in here.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,14 +3,17 @@
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
/*! Data type of Timer callback */
|
typedef struct _ObTimer ObTimer;
|
||||||
typedef void (*TimeoutHandler)(void *data);
|
|
||||||
|
|
||||||
typedef struct Timer {
|
/*! Data type of Timer callback */
|
||||||
|
typedef void (*ObTimeoutHandler)(void *data);
|
||||||
|
|
||||||
|
struct _ObTimer
|
||||||
|
{
|
||||||
/*! Microseconds between timer firings */
|
/*! Microseconds between timer firings */
|
||||||
long delay;
|
long delay;
|
||||||
/*! Callback for timer expiry */
|
/*! Callback for timer expiry */
|
||||||
TimeoutHandler action;
|
ObTimeoutHandler action;
|
||||||
/*! Data sent to callback */
|
/*! Data sent to callback */
|
||||||
void *data;
|
void *data;
|
||||||
/*! We overload the delete operator to just set this to true */
|
/*! We overload the delete operator to just set this to true */
|
||||||
|
@ -19,7 +22,7 @@ typedef struct Timer {
|
||||||
GTimeVal last;
|
GTimeVal last;
|
||||||
/*! When this timer will next trigger */
|
/*! When this timer will next trigger */
|
||||||
GTimeVal timeout;
|
GTimeVal timeout;
|
||||||
} Timer;
|
};
|
||||||
|
|
||||||
/*! Initializes the timer subsection */
|
/*! Initializes the timer subsection */
|
||||||
void timer_startup();
|
void timer_startup();
|
||||||
|
@ -27,9 +30,9 @@ void timer_startup();
|
||||||
void timer_shutdown();
|
void timer_shutdown();
|
||||||
|
|
||||||
/* Creates a new timer with a given delay */
|
/* Creates a new timer with a given delay */
|
||||||
Timer *timer_start(long delay, TimeoutHandler cb, void *data);
|
ObTimer *timer_start(long delay, ObTimeoutHandler cb, void *data);
|
||||||
/* Stops and frees a timer */
|
/* Stops and frees a timer */
|
||||||
void timer_stop(Timer *self);
|
void timer_stop(ObTimer *self);
|
||||||
|
|
||||||
/*! Dispatch all pending timers. Sets wait to the amount of time to wait for
|
/*! 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 */
|
the next timer, or NULL if there are no timers to wait for */
|
||||||
|
|
|
@ -80,7 +80,7 @@ KeyBindingTree *firstnode = NULL;
|
||||||
|
|
||||||
static KeyBindingTree *curpos;
|
static KeyBindingTree *curpos;
|
||||||
static guint reset_key, reset_state;
|
static guint reset_key, reset_state;
|
||||||
static Timer *chain_timer;
|
static ObTimer *chain_timer;
|
||||||
|
|
||||||
static void grab_for_window(Window win, gboolean grab)
|
static void grab_for_window(Window win, gboolean grab)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef enum {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Timed_Menu_Type type;
|
Timed_Menu_Type type;
|
||||||
Timer *timer;
|
ObTimer *timer;
|
||||||
char *command; /* for the PIPE */
|
char *command; /* for the PIPE */
|
||||||
char *buf; /* buffer to hold partially read menu */
|
char *buf; /* buffer to hold partially read menu */
|
||||||
unsigned long buflen; /* how many bytes are in the buffer */
|
unsigned long buflen; /* how many bytes are in the buffer */
|
||||||
|
|
Loading…
Reference in a new issue