summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTORRI Vincent <torri@alf94-3-82-66-248-160.fbx.proxad.net>2007-04-06 17:54:52 +0200
committerTORRI Vincent <torri@alf94-3-82-66-248-160.fbx.proxad.net>2007-04-06 17:54:52 +0200
commit785486dd33723ed0ba207cc5021c5c77c07abd4b (patch)
treedfc3b13c48b868224fc6428c43202339543c04e7
parente1746f704fe6d1157c1a8867ab6e5c784d498042 (diff)
event/events.c
event/xcb_event.h icccm/icccm.c icccm/xcb_icccm.h property/prop.c property/xcb_property.h wm/manage.c wm/xcb_wm.h wm/xcbwm-test.c xcb namespace added, _t sufix added for some types, formatting
-rw-r--r--event/events.c44
-rw-r--r--event/xcb_event.h22
2 files changed, 33 insertions, 33 deletions
diff --git a/event/events.c b/event/events.c
index f7d4fed..2900bd3 100644
--- a/event/events.c
+++ b/event/events.c
@@ -3,37 +3,37 @@
#include "xcb_event.h"
-typedef struct event_handler event_handler_t;
-struct event_handler {
- generic_event_handler handler;
- void *data;
+typedef struct xcb_event_handler_t xcb_event_handler_t;
+struct xcb_event_handler_t {
+ xcb_generic_event_handler_t handler;
+ void *data;
};
-struct event_handlers {
- event_handler_t event[126];
- event_handler_t error[256];
- xcb_connection_t *c;
+struct xcb_event_handlers_t {
+ xcb_event_handler_t event[126];
+ xcb_event_handler_t error[256];
+ xcb_connection_t *c;
};
-event_handlers_t *alloc_event_handlers(xcb_connection_t *c)
+xcb_event_handlers_t *xcb_alloc_event_handlers(xcb_connection_t *c)
{
- event_handlers_t *ret = calloc(1, sizeof(event_handlers_t));
+ xcb_event_handlers_t *ret = calloc(1, sizeof(xcb_event_handlers_t));
if(ret)
ret->c = c;
return ret;
}
-void free_event_handlers(event_handlers_t *evenths)
+void xcb_free_event_handlers(xcb_event_handlers_t *evenths)
{
free(evenths);
}
-xcb_connection_t *get_xcb_connection(event_handlers_t *evenths)
+xcb_connection_t *xcb_get_xcb_connection(xcb_event_handlers_t *evenths)
{
return evenths->c;
}
-static event_handler_t *get_event_handler(event_handlers_t *evenths, int event)
+static xcb_event_handler_t *get_event_handler(xcb_event_handlers_t *evenths, int event)
{
assert(event < 256);
event &= 0x7f;
@@ -41,15 +41,15 @@ static event_handler_t *get_event_handler(event_handlers_t *evenths, int event)
return &evenths->event[event - 2];
}
-static event_handler_t *get_error_handler(event_handlers_t *evenths, int error)
+static xcb_event_handler_t *get_error_handler(xcb_event_handlers_t *evenths, int error)
{
assert(error >= 0 && error < 256);
return &evenths->error[error];
}
-static int handle_event(event_handlers_t *evenths, xcb_generic_event_t *event)
+static int handle_event(xcb_event_handlers_t *evenths, xcb_generic_event_t *event)
{
- event_handler_t *eventh = 0;
+ xcb_event_handler_t *eventh = 0;
assert(event->response_type != 1);
if(event->response_type == 0)
@@ -62,7 +62,7 @@ static int handle_event(event_handlers_t *evenths, xcb_generic_event_t *event)
return 0;
}
-void event_loop(event_handlers_t *evenths)
+void xcb_event_loop(xcb_event_handlers_t *evenths)
{
xcb_generic_event_t *event;
while((event = xcb_wait_for_event(evenths->c)))
@@ -72,18 +72,18 @@ void event_loop(event_handlers_t *evenths)
}
}
-static void set_handler(generic_event_handler handler, void *data, event_handler_t *place)
+static void set_handler(xcb_generic_event_handler_t handler, void *data, xcb_event_handler_t *place)
{
- event_handler_t eventh = { handler, data };
+ xcb_event_handler_t eventh = { handler, data };
*place = eventh;
}
-void set_event_handler(event_handlers_t *evenths, int event, generic_event_handler handler, void *data)
+void xcb_set_event_handler(xcb_event_handlers_t *evenths, int event, xcb_generic_event_handler_t handler, void *data)
{
set_handler(handler, data, get_event_handler(evenths, event));
}
-void set_error_handler(event_handlers_t *evenths, int error, generic_error_handler handler, void *data)
+void xcb_set_error_handler(xcb_event_handlers_t *evenths, int error, xcb_generic_error_handler_t handler, void *data)
{
- set_handler((generic_event_handler) handler, data, get_error_handler(evenths, error));
+ set_handler((xcb_generic_event_handler_t) handler, data, get_error_handler(evenths, error));
}
diff --git a/event/xcb_event.h b/event/xcb_event.h
index 9045a7e..deb7ba8 100644
--- a/event/xcb_event.h
+++ b/event/xcb_event.h
@@ -9,23 +9,23 @@ extern "C" {
#endif
-typedef struct event_handlers event_handlers_t;
-event_handlers_t *alloc_event_handlers(xcb_connection_t *c);
-void free_event_handlers(event_handlers_t *evenths);
-xcb_connection_t *get_xcb_connection(event_handlers_t *evenths);
+typedef struct xcb_event_handlers_t xcb_event_handlers_t;
+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 event_loop(event_handlers_t *evenths);
+void xcb_event_loop(xcb_event_handlers_t *evenths);
-typedef int (*generic_event_handler)(void *data, xcb_connection_t *c, xcb_generic_event_t *event);
-typedef int (*generic_error_handler)(void *data, xcb_connection_t *c, xcb_generic_error_t *error);
+typedef int (*xcb_generic_event_handler_t)(void *data, xcb_connection_t *c, xcb_generic_event_t *event);
+typedef int (*xcb_generic_error_handler_t)(void *data, xcb_connection_t *c, xcb_generic_error_t *error);
-void set_event_handler(event_handlers_t *evenths, int event, generic_event_handler handler, void *data);
-void set_error_handler(event_handlers_t *evenths, int error, generic_error_handler handler, void *data);
+void xcb_set_event_handler(xcb_event_handlers_t *evenths, int event, xcb_generic_event_handler_t handler, void *data);
+void xcb_set_error_handler(xcb_event_handlers_t *evenths, int error, xcb_generic_error_handler_t handler, void *data);
#define MAKE_HANDLER(cls,lkind, ukind) \
-static inline void set_##lkind##_##cls##_handler(event_handlers_t *evenths, int (*handler)(void *, xcb_connection_t *, xcb_##lkind##_##cls##_t *), void *data) \
+static inline void set_##lkind##_##cls##_handler(xcb_event_handlers_t *evenths, int (*handler)(void *, xcb_connection_t *, xcb_##lkind##_##cls##_t *), void *data) \
{ \
- set_##cls##_handler(evenths, XCB_##ukind, (generic_event_handler) handler, data); \
+ xcb_set_##cls##_handler(evenths, XCB_##ukind, (xcb_generic_event_handler_t) handler, data); \
}
MAKE_HANDLER(event, key_press, KEY_PRESS)