X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=obt%2Fmainloop.c;h=753662569013c66d14bd95e58c19340b9646f05e;hb=0c8c9caba6f529c11b04643d24a5a503f49a245b;hp=c0b9bb597e92922d0a5823ea25144e7a847fd096;hpb=890e13b919892887b773462bb866e849e0cb4d91;p=chaz%2Fopenbox diff --git a/obt/mainloop.c b/obt/mainloop.c index c0b9bb59..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 @@ -155,7 +156,7 @@ ObtMainLoop *obt_main_loop_new(void) { ObtMainLoop *loop; - loop = g_new0(ObtMainLoop, 1); + loop = g_slice_new0(ObtMainLoop); loop->ref = 1; FD_ZERO(&loop->fd_set); loop->fd_x = -1; @@ -249,7 +250,7 @@ void obt_main_loop_unref(ObtMainLoop *loop) } } - obt_free0(loop, ObtMainLoop, 1); + g_slice_free(ObtMainLoop, loop); } } @@ -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;