summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Massey <bart@cs.pdx.edu>2008-03-05 13:26:24 -0800
committerBart Massey <bart@cs.pdx.edu>2008-03-05 13:26:24 -0800
commitbfdd59eeecb5eb207c3ae08ef7a7998e5d17a4f3 (patch)
tree9040d9ddeb9232d62ea1984b12824fda7ec2b8b3
parentd0a79c3c95ef2745181430d002cce7a3d43df3e6 (diff)
parentac0bf4c57d550acff68f3f6b12285d356c90d71b (diff)
merged event loop split with last patch
-rw-r--r--event/events.c12
-rw-r--r--event/xcb_event.h3
2 files changed, 13 insertions, 2 deletions
diff --git a/event/events.c b/event/events.c
index 399c6ce..c19d01f 100644
--- a/event/events.c
+++ b/event/events.c
@@ -62,7 +62,7 @@ int xcb_handle_event(xcb_event_handlers_t *evenths, xcb_generic_event_t *event)
return 0;
}
-void xcb_event_loop(xcb_event_handlers_t *evenths)
+void xcb_wait_for_event_loop(xcb_event_handlers_t *evenths)
{
xcb_generic_event_t *event;
while((event = xcb_wait_for_event(evenths->c)))
@@ -72,6 +72,16 @@ void xcb_event_loop(xcb_event_handlers_t *evenths)
}
}
+void xcb_poll_for_event_loop(xcb_event_handlers_t *evenths)
+{
+ xcb_generic_event_t *event;
+ while ((event = xcb_poll_for_event(evenths->c)))
+ {
+ handle_event(evenths, event);
+ free(event);
+ }
+}
+
static void set_handler(xcb_generic_event_handler_t handler, void *data, xcb_event_handler_t *place)
{
xcb_event_handler_t eventh = { handler, data };
diff --git a/event/xcb_event.h b/event/xcb_event.h
index ce4cdcd..e35ceb1 100644
--- a/event/xcb_event.h
+++ b/event/xcb_event.h
@@ -14,7 +14,8 @@ xcb_event_handlers_t *xcb_alloc_event_handlers(xcb_connection_t *c);
void xcb_free_event_handlers(xcb_event_handlers_t *evenths);
xcb_connection_t *xcb_get_xcb_connection(xcb_event_handlers_t *evenths);
-void xcb_event_loop(xcb_event_handlers_t *evenths);
+void xcb_wait_for_event_loop(xcb_event_handlers_t *evenths);
+void xcb_poll_for_event_loop(xcb_event_handlers_t *evenths);
int xcb_handle_event(xcb_event_handlers_t *evenths, xcb_generic_event_t *event);
typedef int (*xcb_generic_event_handler_t)(void *data, xcb_connection_t *c, xcb_generic_event_t *event);