[Xcb-commit] 3 commits - event
Julien Danjou
jdanjou at kemper.freedesktop.org
Tue Apr 14 03:01:01 PDT 2009
event/event.c | 26 +++++++----------------
event/xcb_event.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 62 insertions(+), 25 deletions(-)
New commits:
commit 6ff3c2bfc5f8cd66ccf8cd9f4fe0626178372b3a
Author: Julien Danjou <julien at danjou.info>
Date: Tue Apr 14 11:44:06 2009 +0200
event: add define to get request and error types
Signed-off-by: Julien Danjou <julien at danjou.info>
diff --git a/event/event.c b/event/event.c
index 743232b..ce83d6e 100644
--- a/event/event.c
+++ b/event/event.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2008 Julien Danjou <julien at danjou.info>
+ * Copyright © 2008-2009 Julien Danjou <julien at danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/event/xcb_event.h b/event/xcb_event.h
index 6326158..05b9cac 100644
--- a/event/xcb_event.h
+++ b/event/xcb_event.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Julien Danjou <julien at danjou.info>
+ * Copyright (C) 2008-2009 Julien Danjou <julien at danjou.info>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -55,6 +55,8 @@ extern "C" {
#define XCB_EVENT_RESPONSE_TYPE_MASK (0x7f)
#define XCB_EVENT_RESPONSE_TYPE(e) (e->response_type & XCB_EVENT_RESPONSE_TYPE_MASK)
#define XCB_EVENT_SENT(e) (e->response_type & ~XCB_EVENT_RESPONSE_TYPE_MASK)
+#define XCB_EVENT_ERROR_TYPE(e) (*((uint8_t *) e + 1))
+#define XCB_EVENT_REQUEST_TYPE(e) (*((uint8_t *) e + 10))
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);
commit 84f8352b3726e45c4dcfb0ebd23bdad93abdf5b5
Author: Julien Danjou <julien at danjou.info>
Date: Tue Apr 14 11:24:00 2009 +0200
event: add error values
Signed-off-by: Julien Danjou <julien at danjou.info>
diff --git a/event/xcb_event.h b/event/xcb_event.h
index 0be19bc..6326158 100644
--- a/event/xcb_event.h
+++ b/event/xcb_event.h
@@ -168,6 +168,51 @@ XCB_EVENT_MAKE_EVENT_HANDLER(colormap_notify, COLORMAP_NOTIFY)
XCB_EVENT_MAKE_EVENT_HANDLER(client_message, CLIENT_MESSAGE)
XCB_EVENT_MAKE_EVENT_HANDLER(mapping_notify, MAPPING_NOTIFY)
+/** Everyting is ok */
+#define XCB_EVENT_ERROR_SUCESS 0
+/** Bad request code */
+#define XCB_EVENT_ERROR_BAD_REQUEST 1
+/** Int parameter out of range */
+#define XCB_EVENT_ERROR_BAD_VALUE 2
+/** Parameter not a Window */
+#define XCB_EVENT_ERROR_BAD_WINDOW 3
+/** Parameter not a Pixmap */
+#define XCB_EVENT_ERROR_BAD_PIXMAP 4
+/** Parameter not an Atom */
+#define XCB_EVENT_ERROR_BAD_ATOM 5
+/** Parameter not a Cursor */
+#define XCB_EVENT_ERROR_BAD_CURSOR 6
+/** Parameter not a Font */
+#define XCB_EVENT_ERROR_BAD_FONT 7
+/** Parameter mismatch */
+#define XCB_EVENT_ERROR_BAD_MATCH 8
+/** Parameter not a Pixmap or Window */
+#define XCB_EVENT_ERROR_BAD_DRAWABLE 9
+/* Depending on context:
+ - key/button already grabbed
+ - attempt to free an illegal
+ cmap entry
+ - attempt to store into a read-only
+ color map entry.
+ - attempt to modify the access control
+ list from other than the local host.
+*/
+#define XCB_EVENT_ERROR_BAD_ACCESS 10
+/** Insufficient resources */
+#define XCB_EVENT_ERROR_BAD_ALLOC 11
+/** No such colormap */
+#define XCB_EVENT_ERROR_BAD_COLOR 12
+/** Parameter not a GC */
+#define XCB_EVENT_ERROR_BAD_GC 13
+/** Choice not in range or already used */
+#define XCB_EVENT_ERROR_BAD_ID_CHOICE 14
+/** Font or color name doesn't exist */
+#define XCB_EVENT_ERROR_BAD_NAME 15
+/** Request length incorrect */
+#define XCB_EVENT_ERROR_BAD_LENGTH 16
+/** Server is defective */
+#define XCB_EVENT_ERROR_BAD_IMPLEMENTATION 17
+
/**
* @brief Convert an event reponse type to a label.
* @param type The event type.
commit 24c849af4e259319a7e233a8ae9d56001a831a18
Author: Julien Danjou <julien at danjou.info>
Date: Tue Apr 14 11:16:52 2009 +0200
event: simplify proto
Signed-off-by: Julien Danjou <julien at danjou.info>
diff --git a/event/event.c b/event/event.c
index 3d8fd7c..743232b 100644
--- a/event/event.c
+++ b/event/event.c
@@ -311,35 +311,25 @@ static const char *labelEvent[] =
};
const char *
-xcb_event_get_label(const xcb_generic_event_t *e)
+xcb_event_get_label(uint8_t type)
{
- uint32_t type = XCB_EVENT_RESPONSE_TYPE(e);
if(type < countof(labelEvent))
return labelEvent[type];
return NULL;
}
const char *
-xcb_event_get_error_label(const xcb_generic_event_t *e)
+xcb_event_get_error_label(uint8_t type)
{
- /* Check that it's an error */
- if(e->response_type == 0)
- {
- uint32_t type = XCB_EVENT_RESPONSE_TYPE(e) + 1;
- if(type < countof(labelError))
- return labelError[type];
- }
+ if(type < countof(labelError))
+ return labelError[type];
return NULL;
}
const char *
-xcb_event_get_request_label(const xcb_generic_event_t *e)
+xcb_event_get_request_label(uint8_t type)
{
- if(e->response_type == 0)
- {
- uint32_t type = XCB_EVENT_RESPONSE_TYPE(e) + 10;
- if(type < countof(labelRequest))
- return labelRequest[type];
- }
+ if(type < countof(labelRequest))
+ return labelRequest[type];
return NULL;
}
diff --git a/event/xcb_event.h b/event/xcb_event.h
index 4324931..0be19bc 100644
--- a/event/xcb_event.h
+++ b/event/xcb_event.h
@@ -170,26 +170,26 @@ XCB_EVENT_MAKE_EVENT_HANDLER(mapping_notify, MAPPING_NOTIFY)
/**
* @brief Convert an event reponse type to a label.
- * @param e The event.
+ * @param type The event type.
* @return A string with the event name, or NULL if unknown.
*/
-const char * xcb_event_get_label(const xcb_generic_event_t *e);
+const char * xcb_event_get_label(uint8_t type);
/**
* @brief Convert an event error type to a label.
- * @param e The event.
+ * @param type The erro type.
* @return A string with the event name, or NULL if unknown or if the event is
* not an error.
*/
-const char * xcb_event_get_error_label(const xcb_generic_event_t *e);
+const char * xcb_event_get_error_label(uint8_t type);
/**
* @brief Convert an event request type to a label.
- * @param e The event.
+ * @param type The request type.
* @return A string with the event name, or NULL if unknown or if the event is
* not an error.
*/
-const char * xcb_event_get_request_label(const xcb_generic_event_t *e);
+const char * xcb_event_get_request_label(uint8_t type);
#ifdef __cplusplus
}
More information about the xcb-commit
mailing list