summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Osgood <iano@quirkster.com>2006-09-24 13:34:03 -0700
committerArnaud Fontaine <arnau@debian.org>2010-11-14 19:49:47 +0900
commit817d5a1b72d1e2822b8dc4706a276f3b025a464f (patch)
tree0a1d2f2f77c2d0a5d08a346f1898514f60db14e7
parented0e9f4ed98188a80462c5c2964f7383faec2b4f (diff)
All xcb-util libraries compile after the Great Renaming.
Many of the exported library functions still need to follow the new convention.
-rw-r--r--atom/atoms.gperf.m440
-rw-r--r--atom/xcb_atom.h.m416
-rw-r--r--event/events.c55
-rw-r--r--event/xcb_event.h90
4 files changed, 101 insertions, 100 deletions
diff --git a/atom/atoms.gperf.m4 b/atom/atoms.gperf.m4
index a628097..9a4e889 100644
--- a/atom/atoms.gperf.m4
+++ b/atom/atoms.gperf.m4
@@ -4,7 +4,7 @@
#include "xcb_atom.h"
define(`COUNT', 0)dnl
-define(`DO', `const XCBATOM $1 = { define(`COUNT', incr(COUNT))COUNT };')dnl
+define(`DO', `const xcb_atom_t $1 = { define(`COUNT', incr(COUNT))COUNT };')dnl
include(atomlist.m4)`'dnl
%}
@@ -16,7 +16,7 @@ include(atomlist.m4)`'dnl
%compare-strncmp
%struct-type
-struct atom_map { int name; XCBATOM value; };
+struct atom_map { int name; xcb_atom_t value; };
%%
define(`DO', `$1,{ define(`COUNT', incr(COUNT))COUNT }')dnl
include(atomlist.m4)`'dnl
@@ -26,41 +26,41 @@ define(`DO', ` "$1",')dnl
include(atomlist.m4)`'dnl
};
-XCBATOM InternAtomPredefined(CARD16 name_len, const char *name)
+xcb_atom_t intern_atom_predefined(uint16_t name_len, const char *name)
{
const struct atom_map *value = in_word_set(name, name_len);
- XCBATOM ret = { XCBNone };
+ xcb_atom_t ret = { XCB_NONE };
if(value)
ret = value->value;
return ret;
}
-InternAtomFastCookie InternAtomFast(XCBConnection *c, BOOL only_if_exists, CARD16 name_len, const char *name)
+intern_atom_fast_cookie_t intern_atom_fast(xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name)
{
- InternAtomFastCookie cookie;
+ intern_atom_fast_cookie_t cookie;
- if((cookie.u.atom = InternAtomPredefined(name_len, name)).xid != XCBNone)
+ if((cookie.u.atom = intern_atom_predefined(name_len, name)).xid != XCB_NONE)
{
cookie.tag = TAG_VALUE;
return cookie;
}
cookie.tag = TAG_COOKIE;
- cookie.u.cookie = XCBInternAtom(c, only_if_exists, name_len, name);
+ cookie.u.cookie = xcb_intern_atom(c, only_if_exists, name_len, name);
return cookie;
}
-XCBATOM InternAtomFastReply(XCBConnection *c, InternAtomFastCookie cookie, XCBGenericError **e)
+xcb_atom_t intern_atom_fast_reply(xcb_connection_t *c, intern_atom_fast_cookie_t cookie, xcb_generic_error_t **e)
{
switch(cookie.tag)
{
- XCBInternAtomRep *reply;
+ xcb_intern_atom_reply_t *reply;
case TAG_VALUE:
if(e)
*e = 0;
break;
case TAG_COOKIE:
- reply = XCBInternAtomReply(c, cookie.u.cookie, e);
+ reply = xcb_intern_atom_reply(c, cookie.u.cookie, e);
if(reply)
{
cookie.u.atom = reply->atom;
@@ -73,35 +73,35 @@ XCBATOM InternAtomFastReply(XCBConnection *c, InternAtomFastCookie cookie, XCBGe
return cookie.u.atom;
}
-const char *GetAtomNamePredefined(XCBATOM atom)
+const char *get_atom_name_predefined(xcb_atom_t atom)
{
if(atom.xid <= 0 || atom.xid > (sizeof(atom_names) / sizeof(*atom_names)))
return 0;
return atom_names[atom.xid - 1];
}
-int GetAtomName(XCBConnection *c, XCBATOM atom, const char **namep, int *lengthp)
+int get_atom_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp)
{
static char buf[100];
- const char *name = GetAtomNamePredefined(atom);
+ const char *name = get_atom_name_predefined(atom);
int len;
- XCBGetAtomNameCookie atomc;
- XCBGetAtomNameRep *atomr;
+ xcb_get_atom_name_cookie_t atomc;
+ xcb_get_atom_name_reply_t *atomr;
if(name)
{
*namep = name;
*lengthp = strlen(name);
return 1;
}
- atomc = XCBGetAtomName(c, atom);
- atomr = XCBGetAtomNameReply(c, atomc, 0);
+ atomc = xcb_get_atom_name(c, atom);
+ atomr = xcb_get_atom_name_reply(c, atomc, 0);
if(!atomr)
return 0;
- len = XCBGetAtomNameNameLength(atomr);
+ len = xcb_get_atom_name_name_length(atomr);
if(len > sizeof(buf))
len = sizeof(buf);
*lengthp = len;
- memcpy(buf, XCBGetAtomNameName(atomr), len);
+ memcpy(buf, xcb_get_atom_name_name(atomr), len);
*namep = buf;
free(atomr);
return 1;
diff --git a/atom/xcb_atom.h.m4 b/atom/xcb_atom.h.m4
index 7a88cfc..b5f0f5d 100644
--- a/atom/xcb_atom.h.m4
+++ b/atom/xcb_atom.h.m4
@@ -8,19 +8,19 @@ enum tag_t {
typedef struct {
enum tag_t tag;
union {
- XCBInternAtomCookie cookie;
- XCBATOM atom;
+ xcb_intern_atom_cookie_t cookie;
+ xcb_atom_t atom;
} u;
} InternAtomFastCookie;
-XCBATOM InternAtomPredefined(CARD16 name_len, const char *name);
-InternAtomFastCookie InternAtomFast(XCBConnection *c, BOOL only_if_exists, CARD16 name_len, const char *name);
-XCBATOM InternAtomFastReply(XCBConnection *c, InternAtomFastCookie cookie, XCBGenericError **e);
+xcb_atom_t InternAtomPredefined(uint16_t name_len, const char *name);
+InternAtomFastCookie InternAtomFast(xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name);
+xcb_atom_t InternAtomFastReply(xcb_connection_t *c, InternAtomFastCookie cookie, xcb_generic_error_t **e);
-const char *GetAtomNamePredefined(XCBATOM atom);
-int GetAtomName(XCBConnection *c, XCBATOM atom, const char **namep, int *lengthp);
+const char *GetAtomNamePredefined(xcb_atom_t atom);
+int GetAtomName(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp);
-define(`DO', `extern const XCBATOM $1;')dnl
+define(`DO', `extern const xcb_atom_t $1;')dnl
include(atomlist.m4)`'dnl
#endif /* ATOMS_H */
diff --git a/event/events.c b/event/events.c
index 6649eee..f7d4fed 100644
--- a/event/events.c
+++ b/event/events.c
@@ -3,36 +3,37 @@
#include "xcb_event.h"
-typedef struct {
- GenericEventHandler handler;
+typedef struct event_handler event_handler_t;
+struct event_handler {
+ generic_event_handler handler;
void *data;
-} EventHandler;
+};
-struct EventHandlers {
- EventHandler event[126];
- EventHandler error[256];
- XCBConnection *c;
+struct event_handlers {
+ event_handler_t event[126];
+ event_handler_t error[256];
+ xcb_connection_t *c;
};
-EventHandlers *allocEventHandlers(XCBConnection *c)
+event_handlers_t *alloc_event_handlers(xcb_connection_t *c)
{
- EventHandlers *ret = calloc(1, sizeof(EventHandlers));
+ event_handlers_t *ret = calloc(1, sizeof(event_handlers_t));
if(ret)
ret->c = c;
return ret;
}
-void freeEventHandlers(EventHandlers *evenths)
+void free_event_handlers(event_handlers_t *evenths)
{
free(evenths);
}
-XCBConnection *getXCBConnection(EventHandlers *evenths)
+xcb_connection_t *get_xcb_connection(event_handlers_t *evenths)
{
return evenths->c;
}
-static EventHandler *getEventHandler(EventHandlers *evenths, int event)
+static event_handler_t *get_event_handler(event_handlers_t *evenths, int event)
{
assert(event < 256);
event &= 0x7f;
@@ -40,49 +41,49 @@ static EventHandler *getEventHandler(EventHandlers *evenths, int event)
return &evenths->event[event - 2];
}
-static EventHandler *getErrorHandler(EventHandlers *evenths, int error)
+static event_handler_t *get_error_handler(event_handlers_t *evenths, int error)
{
assert(error >= 0 && error < 256);
return &evenths->error[error];
}
-static int handleEvent(EventHandlers *evenths, XCBGenericEvent *event)
+static int handle_event(event_handlers_t *evenths, xcb_generic_event_t *event)
{
- EventHandler *eventh = 0;
+ event_handler_t *eventh = 0;
assert(event->response_type != 1);
if(event->response_type == 0)
- eventh = getErrorHandler(evenths, ((XCBGenericError *) event)->error_code);
+ eventh = get_error_handler(evenths, ((xcb_generic_error_t *) event)->error_code);
else
- eventh = getEventHandler(evenths, event->response_type);
+ eventh = get_event_handler(evenths, event->response_type);
if(eventh->handler)
return eventh->handler(eventh->data, evenths->c, event);
return 0;
}
-void eventLoop(EventHandlers *evenths)
+void event_loop(event_handlers_t *evenths)
{
- XCBGenericEvent *event;
- while((event = XCBWaitForEvent(evenths->c)))
+ xcb_generic_event_t *event;
+ while((event = xcb_wait_for_event(evenths->c)))
{
- handleEvent(evenths, event);
+ handle_event(evenths, event);
free(event);
}
}
-static void setHandler(GenericEventHandler handler, void *data, EventHandler *place)
+static void set_handler(generic_event_handler handler, void *data, event_handler_t *place)
{
- EventHandler eventh = { handler, data };
+ event_handler_t eventh = { handler, data };
*place = eventh;
}
-void setEventHandler(EventHandlers *evenths, int event, GenericEventHandler handler, void *data)
+void set_event_handler(event_handlers_t *evenths, int event, generic_event_handler handler, void *data)
{
- setHandler(handler, data, getEventHandler(evenths, event));
+ set_handler(handler, data, get_event_handler(evenths, event));
}
-void setErrorHandler(EventHandlers *evenths, int error, GenericErrorHandler handler, void *data)
+void set_error_handler(event_handlers_t *evenths, int error, generic_error_handler handler, void *data)
{
- setHandler((GenericEventHandler) handler, data, getErrorHandler(evenths, error));
+ set_handler((generic_event_handler) handler, data, get_error_handler(evenths, error));
}
diff --git a/event/xcb_event.h b/event/xcb_event.h
index 84b7f04..1042066 100644
--- a/event/xcb_event.h
+++ b/event/xcb_event.h
@@ -9,58 +9,58 @@ extern "C" {
#endif
-typedef struct EventHandlers EventHandlers;
-EventHandlers *allocEventHandlers(XCBConnection *c);
-void freeEventHandlers(EventHandlers *evenths);
-XCBConnection *getXCBConnection(EventHandlers *evenths);
+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);
-void eventLoop(EventHandlers *evenths);
+void event_loop(event_handlers_t *evenths);
-typedef int (*GenericEventHandler)(void *data, XCBConnection *c, XCBGenericEvent *event);
-typedef int (*GenericErrorHandler)(void *data, XCBConnection *c, XCBGenericError *error);
+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);
-void setEventHandler(EventHandlers *evenths, int event, GenericEventHandler handler, void *data);
-void setErrorHandler(EventHandlers *evenths, int error, GenericErrorHandler handler, void *data);
+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);
-#define MAKE_HANDLER(cls,kind) \
-static inline void set##kind##cls##Handler(EventHandlers *evenths, int (*handler)(void *, XCBConnection *, XCB##kind##cls *), 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) \
{ \
- set##cls##Handler(evenths, XCB##kind, (GenericEventHandler) handler, data); \
+ set_##cls##_handler(evenths, XCB_##ukind, (generic_event_handler) handler, data); \
}
-MAKE_HANDLER(Event, KeyPress)
-MAKE_HANDLER(Event, KeyRelease)
-MAKE_HANDLER(Event, ButtonPress)
-MAKE_HANDLER(Event, ButtonRelease)
-MAKE_HANDLER(Event, MotionNotify)
-MAKE_HANDLER(Event, EnterNotify)
-MAKE_HANDLER(Event, LeaveNotify)
-MAKE_HANDLER(Event, FocusIn)
-MAKE_HANDLER(Event, FocusOut)
-MAKE_HANDLER(Event, KeymapNotify)
-MAKE_HANDLER(Event, Expose)
-MAKE_HANDLER(Event, GraphicsExposure)
-MAKE_HANDLER(Event, NoExposure)
-MAKE_HANDLER(Event, VisibilityNotify)
-MAKE_HANDLER(Event, CreateNotify)
-MAKE_HANDLER(Event, DestroyNotify)
-MAKE_HANDLER(Event, UnmapNotify)
-MAKE_HANDLER(Event, MapNotify)
-MAKE_HANDLER(Event, MapRequest)
-MAKE_HANDLER(Event, ReparentNotify)
-MAKE_HANDLER(Event, ConfigureNotify)
-MAKE_HANDLER(Event, ConfigureRequest)
-MAKE_HANDLER(Event, GravityNotify)
-MAKE_HANDLER(Event, ResizeRequest)
-MAKE_HANDLER(Event, CirculateNotify)
-MAKE_HANDLER(Event, CirculateRequest)
-MAKE_HANDLER(Event, PropertyNotify)
-MAKE_HANDLER(Event, SelectionClear)
-MAKE_HANDLER(Event, SelectionRequest)
-MAKE_HANDLER(Event, SelectionNotify)
-MAKE_HANDLER(Event, ColormapNotify)
-MAKE_HANDLER(Event, ClientMessage)
-MAKE_HANDLER(Event, MappingNotify)
+MAKE_HANDLER(event, key_press, KEY_PRESS)
+MAKE_HANDLER(event, key_release, KEY_RELEASE)
+MAKE_HANDLER(event, button_press, BUTTON_PRESS)
+MAKE_HANDLER(event, button_release, BUTTON_RELEASE)
+MAKE_HANDLER(event, motion_notify, MOTION_NOTIFY)
+MAKE_HANDLER(event, enter_notify, ENTER_NOTIFY)
+MAKE_HANDLER(event, leave_notify, LEAVE_NOTIFY)
+MAKE_HANDLER(event, focus_in, FOCUS_IN)
+MAKE_HANDLER(event, focus_out, FOCUS_OUT)
+MAKE_HANDLER(event, keymap_notify, KEYMAP_NOTIFY)
+MAKE_HANDLER(event, expose, EXPOSE)
+MAKE_HANDLER(event, graphics_exposure, GRAPHICS_EXPOSURE)
+MAKE_HANDLER(event, no_exposure, NO_EXPOSURE)
+MAKE_HANDLER(event, visibility_notify, VISIBILITY_NOTIFY)
+MAKE_HANDLER(event, create_notify, CREATE_NOTIFY)
+MAKE_HANDLER(event, destroy_notify, DESTROY_NOTIFY)
+MAKE_HANDLER(event, unmap_notify, UNMAP_NOTIFY)
+MAKE_HANDLER(event, map_notify, MAP_NOTIFY)
+MAKE_HANDLER(event, map_request, MAP_REQUEST)
+MAKE_HANDLER(event, reparent_notify, REPARENT_NOTIFY)
+MAKE_HANDLER(event, configure_notify, CONFIGURE_NOTIFY)
+MAKE_HANDLER(event, configure_request, CONFIGURE_REQUEST)
+MAKE_HANDLER(event, gravity_notify, GRAVITY_NOTIFY)
+MAKE_HANDLER(event, resize_request, RESIZE_REQUEST)
+MAKE_HANDLER(event, circulate_notify, CIRCULATE_NOTIFY)
+MAKE_HANDLER(event, circulate_request, CIRCULATE_REQUEST)
+MAKE_HANDLER(event, property_notify, PROPERTY_NOTIFY)
+MAKE_HANDLER(event, selection_clear, SELECTION_CLEAR)
+MAKE_HANDLER(event, selection_request, SELECTION_REQUEST)
+MAKE_HANDLER(event, selection_notify, SELECTION_NOTIFY)
+MAKE_HANDLER(event, colormap_notify, COLORMAP_NOTIFY)
+MAKE_HANDLER(event, client_message, CLIENT_MESSAGE)
+MAKE_HANDLER(event, mapping_notify, MAPPING_NOTIFY)
#ifdef __cplusplus