diff options
| author | Dana Jansens <danakj@orodu.net> | 2010-04-28 12:57:51 -0400 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2010-04-28 12:58:42 -0400 |
| commit | 55b84316bb699fa530efe78d75ae8e1d57c1b57f (patch) | |
| tree | 4991974287c7adfdea0680b5d96d42a01c40a97a /obt/mainloop.c | |
| parent | 029628087fa0090e7c3b1598786a1bf1712e0db9 (diff) | |
make an event queue for X events. the queue's min size is 16 XEvents (~3k)
Diffstat (limited to 'obt/mainloop.c')
| -rw-r--r-- | obt/mainloop.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/obt/mainloop.c b/obt/mainloop.c index ecdd7f7f..75366256 100644 --- a/obt/mainloop.c +++ b/obt/mainloop.c @@ -19,6 +19,7 @@ #include "obt/mainloop.h" #include "obt/display.h" +#include "obt/xqueue.h" #include "obt/util.h" #ifdef HAVE_STDIO_H @@ -296,10 +297,8 @@ void obt_main_loop_run(ObtMainLoop *loop) loop->signal_fired = FALSE; sigprocmask(SIG_SETMASK, &oldset, NULL); - } else if (loop->display && XPending(loop->display)) { - do { - XNextEvent(loop->display, &e); - + } else if (loop->display && xqueue_pending_local()) { + while (xqueue_next_local(&e) && loop->run) { if (e.type == MappingNotify) XRefreshKeyboardMapping(&e.xmapping); @@ -307,10 +306,9 @@ void obt_main_loop_run(ObtMainLoop *loop) ObtMainLoopXHandlerType *h = it->data; h->func(&e, h->data); } - } while (XPending(loop->display) && loop->run); + } } else { /* this only runs if there were no x events received */ - timer_dispatch(loop, (GTimeVal**)&wait); selset = loop->fd_set; |
