#include "obt/mainloop.h"
#include "obt/display.h"
+#include "obt/xqueue.h"
#include "obt/util.h"
#ifdef HAVE_STDIO_H
{
ObtMainLoop *loop;
- loop = g_new0(ObtMainLoop, 1);
+ loop = g_slice_new0(ObtMainLoop);
loop->ref = 1;
FD_ZERO(&loop->fd_set);
loop->fd_x = -1;
}
}
- obt_free0(loop, ObtMainLoop, 1);
+ g_slice_free(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);
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;