diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-08-30 07:20:16 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-08-30 07:20:16 +0000 |
| commit | de4f92ccc66c1dad1a2820a07d1f0161bd61a855 (patch) | |
| tree | 6e782bca4561b33808d7b96c5df77895093ee3b3 /openbox/keyboard.c | |
| parent | 952ca245714e334090ea6baced5eb75d06f99e18 (diff) | |
using the ObMainLoop, which rulz the planet
Diffstat (limited to 'openbox/keyboard.c')
| -rw-r--r-- | openbox/keyboard.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/openbox/keyboard.c b/openbox/keyboard.c index 42eea890..86ead528 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -1,3 +1,4 @@ +#include "mainloop.h" #include "focus.h" #include "screen.h" #include "frame.h" @@ -7,7 +8,6 @@ #include "client.h" #include "action.h" #include "prop.h" -#include "timer.h" #include "config.h" #include "keytree.h" #include "keyboard.h" @@ -27,7 +27,6 @@ typedef struct { static GSList *interactive_states; static KeyBindingTree *curpos; -static ObTimer *chain_timer; static void grab_for_window(Window win, gboolean grab) { @@ -62,23 +61,23 @@ static void grab_keys(gboolean grab) grab_for_window(((ObClient*)it->data)->frame->window, grab); } +static gboolean chain_timeout(gpointer data) +{ + keyboard_reset_chains(); + + return FALSE; /* don't repeat */ +} + void keyboard_reset_chains() { - if (chain_timer) { - timer_stop(chain_timer); - chain_timer = NULL; - } + ob_main_loop_timeout_remove(ob_main_loop, chain_timeout); + if (curpos) { curpos = NULL; grab_keys(TRUE); } } -static void chain_timeout(ObTimer *t, void *data) -{ - keyboard_reset_chains(); -} - gboolean keyboard_bind(GList *keylist, ObAction *action) { KeyBindingTree *tree, *t; @@ -213,10 +212,10 @@ void keyboard_event(ObClient *client, const XEvent *e) if (p->key == e->xkey.keycode && p->state == e->xkey.state) { if (p->first_child != NULL) { /* part of a chain */ - if (chain_timer) timer_stop(chain_timer); + ob_main_loop_timeout_remove(ob_main_loop, chain_timeout); /* 5 second timeout for chains */ - chain_timer = timer_start(5000*1000, chain_timeout, - NULL); + ob_main_loop_timeout_add(ob_main_loop, 5 * G_USEC_PER_SEC, + chain_timeout, NULL, NULL); curpos = p; grab_keys(TRUE); } else { |
