summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-06-24 10:48:35 -0700
committerArnaud Fontaine <arnau@debian.org>2010-11-14 19:52:37 +0900
commit81c62e7a04213abefa1ea82819887aaaa3c31a74 (patch)
treedc84d4c36248c59813b3ce57489575206ff7e672
parent16dd0d5a26b6efc8ed49daa56c9006a0abcc3f53 (diff)
downloadxcb-util-81c62e7a04213abefa1ea82819887aaaa3c31a74.tar.gz
Delete callback-based APIs for events, properties, and replies.
They are poorly designed and not terribly useful. I wrote the original versions of these libraries for demonstration purposes and would like to actively discourage anyone from actually using them. After deleting the callback-based APIs, there was nothing interesting left in property or reply, so those libraries are deleted outright. The event library is no longer particularly related to event handling, but that's a problem for another commit. The icccm library had some simple hooks for integrating with the property library, which are precisely as useful as the property library itself, so I deleted them too. (Arnaud suggested this in <sa5ocib84hf.fsf@Orfeo.duckcorp.org>.) Since the icccm and event libraries have changed interfaces, this commit bumps their SONAME versions. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Acked-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--configure.ac10
-rw-r--r--event/Makefile.am2
-rw-r--r--event/event.c86
-rw-r--r--event/xcb_event.h112
4 files changed, 1 insertions, 209 deletions
diff --git a/configure.ac b/configure.ac
index 036f886..3d1a983 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,31 +80,21 @@ XCB_AUX_CFLAGS='-I$(top_srcdir)/aux'
XCB_AUX_LIBS='$(top_builddir)/aux/libxcb-aux.la'
XCB_ATOM_CFLAGS='-I$(top_srcdir)/atom -I$(top_builddir)/atom'
XCB_ATOM_LIBS='$(top_builddir)/atom/libxcb-atom.la'
-XCB_EVENT_CFLAGS='-I$(top_srcdir)/event'
-XCB_EVENT_LIBS='$(top_builddir)/event/libxcb-event.la'
-XCB_PROPERTY_CFLAGS='-I$(top_srcdir)/property'
-XCB_PROPERTY_LIBS='$(top_builddir)/property/libxcb-property.la'
XCB_ICCCM_CFLAGS='-I$(top_srcdir)/icccm'
XCB_ICCCM_LIBS='$(top_builddir)/icccm/libxcb-icccm.la'
AC_SUBST(XCB_AUX_CFLAGS)
AC_SUBST(XCB_AUX_LIBS)
AC_SUBST(XCB_ATOM_CFLAGS)
AC_SUBST(XCB_ATOM_LIBS)
-AC_SUBST(XCB_EVENT_CFLAGS)
-AC_SUBST(XCB_EVENT_LIBS)
-AC_SUBST(XCB_PROPERTY_CFLAGS)
-AC_SUBST(XCB_PROPERTY_LIBS)
AC_SUBST(XCB_ICCCM_CFLAGS)
AC_SUBST(XCB_ICCCM_LIBS)
AC_OUTPUT([Makefile
aux/Makefile aux/xcb-aux.pc
- reply/Makefile reply/xcb-reply.pc
image/Makefile image/xcb-image.pc
atom/Makefile atom/xcb-atom.pc
event/Makefile event/xcb-event.pc
keysyms/Makefile keysyms/xcb-keysyms.pc
- property/Makefile property/xcb-property.pc
icccm/Makefile icccm/xcb-icccm.pc
wm/Makefile wm/xcb-wm.pc
xcb_util_intro
diff --git a/event/Makefile.am b/event/Makefile.am
index 5a7d819..cec6381 100644
--- a/event/Makefile.am
+++ b/event/Makefile.am
@@ -10,7 +10,7 @@ AM_CFLAGS = $(CWARNFLAGS)
libxcb_event_la_SOURCES = event.c
libxcb_event_la_CPPFLAGS = $(XCB_CFLAGS)
libxcb_event_la_LIBADD = $(XCB_LIBS)
-libxcb_event_la_LDFLAGS = -version-info 1:0:0
+libxcb_event_la_LDFLAGS = -version-info 2:0:0
pkgconfig_DATA = xcb-event.pc
diff --git a/event/event.c b/event/event.c
index 7faac1c..f770612 100644
--- a/event/event.c
+++ b/event/event.c
@@ -33,92 +33,6 @@
#include "xcb_event.h"
#include "../xcb-util-common.h"
-void
-xcb_event_handlers_init(xcb_connection_t *c, xcb_event_handlers_t *evenths)
-{
- memset(evenths, 0, sizeof(xcb_event_handlers_t));
- evenths->c = c;
-}
-
-xcb_connection_t *
-xcb_event_get_xcb_connection(xcb_event_handlers_t *evenths)
-{
- return evenths->c;
-}
-
-static xcb_event_handler_t *
-get_event_handler(xcb_event_handlers_t *evenths, int event)
-{
- assert(event < 256);
- event &= XCB_EVENT_RESPONSE_TYPE_MASK;
- assert(event >= 2);
- return &evenths->event[event - 2];
-}
-
-static xcb_event_handler_t *
-get_error_handler(xcb_event_handlers_t *evenths, int error)
-{
- assert(error >= 0 && error < 256);
- return &evenths->error[error];
-}
-
-int
-xcb_event_handle(xcb_event_handlers_t *evenths, xcb_generic_event_t *event)
-{
- xcb_event_handler_t *eventh = 0;
- assert(event->response_type != 1);
-
- if(event->response_type == 0)
- eventh = get_error_handler(evenths, ((xcb_generic_error_t *) event)->error_code);
- else
- eventh = get_event_handler(evenths, event->response_type);
-
- if(eventh->handler)
- return eventh->handler(eventh->data, evenths->c, event);
- return 0;
-}
-
-void
-xcb_event_wait_for_event_loop(xcb_event_handlers_t *evenths)
-{
- xcb_generic_event_t *event;
- while((event = xcb_wait_for_event(evenths->c)))
- {
- xcb_event_handle(evenths, event);
- free(event);
- }
-}
-
-void
-xcb_event_poll_for_event_loop(xcb_event_handlers_t *evenths)
-{
- xcb_generic_event_t *event;
- while ((event = xcb_poll_for_event(evenths->c)))
- {
- xcb_event_handle(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 };
- *place = eventh;
-}
-
-void
-xcb_event_set_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
-xcb_event_set_error_handler(xcb_event_handlers_t *evenths, int error, xcb_generic_error_handler_t handler, void *data)
-{
- set_handler((xcb_generic_event_handler_t) handler, data, get_error_handler(evenths, error));
-}
-
static const char *labelError[] =
{
"Success",
diff --git a/event/xcb_event.h b/event/xcb_event.h
index 8978cca..ee911fc 100644
--- a/event/xcb_event.h
+++ b/event/xcb_event.h
@@ -56,118 +56,6 @@ extern "C" {
#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)
-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);
-
-typedef struct xcb_event_handler xcb_event_handler_t;
-struct xcb_event_handler
-{
- xcb_generic_event_handler_t handler;
- void *data;
-};
-
-typedef struct xcb_event_handlers xcb_event_handlers_t;
-struct xcb_event_handlers
-{
- xcb_event_handler_t event[126];
- xcb_event_handler_t error[256];
- xcb_connection_t *c;
-};
-
-/**
- * @brief Initialize event handlers data structure.
- * @param c The connection to the X server.
- * @param evenths A pointer to the event handler data structure to initialize.
- */
-void xcb_event_handlers_init(xcb_connection_t *c, xcb_event_handlers_t *evenths);
-
-/**
- * @brief Get X connection used in event handlers.
- * @param evenths The event handlers.
- * @return The connection to the X server.
- */
-xcb_connection_t *xcb_event_get_xcb_connection(xcb_event_handlers_t *evenths);
-
-/**
- * @brief Wait for event and handle it with event handler.
- * @param evenths The event handlers.
- */
-void xcb_event_wait_for_event_loop(xcb_event_handlers_t *evenths);
-
-/**
- * @brief Poll for event and handle it with event handler.
- * @param evenths The event handlers.
- */
-void xcb_event_poll_for_event_loop(xcb_event_handlers_t *evenths);
-
-/**
- * @brief Handle an event using event handlers from event handlers data
- * structure.
- * @param evenths The event handlers.
- * @param event The event to handle.
- * @return The return value of the handler, or 0 if no handler exists for this
- * event.
- */
-int xcb_event_handle(xcb_event_handlers_t *evenths, xcb_generic_event_t *event);
-
-/**
- * @brief Set an event handler for an event type.
- * @param evenths The event handlers data structure.
- * @param event The event type.
- * @param handler The callback function to call for this event type.
- * @param data Optional data pointer to pass to handler callback function.
- */
-void xcb_event_set_handler(xcb_event_handlers_t *evenths, int event, xcb_generic_event_handler_t handler, void *data);
-
-/**
- * @brief Set an error handler for an error type.
- * @param evenths The error handlers data structure.
- * @param error The error type.
- * @param handler The callback function to call for this error type.
- * @param data Optional data pointer to pass to handler callback function.
- */
-void xcb_event_set_error_handler(xcb_event_handlers_t *evenths, int error, xcb_generic_error_handler_t handler, void *data);
-
-#define XCB_EVENT_MAKE_EVENT_HANDLER(lkind, ukind) \
-static inline void xcb_event_set_##lkind##_handler(xcb_event_handlers_t *evenths, int (*handler)(void *, xcb_connection_t *, xcb_##lkind##_event_t *), void *data) \
-{ \
- xcb_event_set_handler(evenths, XCB_##ukind, (xcb_generic_event_handler_t) handler, data); \
-}
-
-XCB_EVENT_MAKE_EVENT_HANDLER(key_press, KEY_PRESS)
-XCB_EVENT_MAKE_EVENT_HANDLER(key_release, KEY_RELEASE)
-XCB_EVENT_MAKE_EVENT_HANDLER(button_press, BUTTON_PRESS)
-XCB_EVENT_MAKE_EVENT_HANDLER(button_release, BUTTON_RELEASE)
-XCB_EVENT_MAKE_EVENT_HANDLER(motion_notify, MOTION_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(enter_notify, ENTER_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(leave_notify, LEAVE_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(focus_in, FOCUS_IN)
-XCB_EVENT_MAKE_EVENT_HANDLER(focus_out, FOCUS_OUT)
-XCB_EVENT_MAKE_EVENT_HANDLER(keymap_notify, KEYMAP_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(expose, EXPOSE)
-XCB_EVENT_MAKE_EVENT_HANDLER(graphics_exposure, GRAPHICS_EXPOSURE)
-XCB_EVENT_MAKE_EVENT_HANDLER(no_exposure, NO_EXPOSURE)
-XCB_EVENT_MAKE_EVENT_HANDLER(visibility_notify, VISIBILITY_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(create_notify, CREATE_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(destroy_notify, DESTROY_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(unmap_notify, UNMAP_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(map_notify, MAP_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(map_request, MAP_REQUEST)
-XCB_EVENT_MAKE_EVENT_HANDLER(reparent_notify, REPARENT_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(configure_notify, CONFIGURE_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(configure_request, CONFIGURE_REQUEST)
-XCB_EVENT_MAKE_EVENT_HANDLER(gravity_notify, GRAVITY_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(resize_request, RESIZE_REQUEST)
-XCB_EVENT_MAKE_EVENT_HANDLER(circulate_notify, CIRCULATE_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(circulate_request, CIRCULATE_REQUEST)
-XCB_EVENT_MAKE_EVENT_HANDLER(property_notify, PROPERTY_NOTIFY)
-XCB_EVENT_MAKE_EVENT_HANDLER(selection_clear, SELECTION_CLEAR)
-XCB_EVENT_MAKE_EVENT_HANDLER(selection_request, SELECTION_REQUEST)
-XCB_EVENT_MAKE_EVENT_HANDLER(selection_notify, SELECTION_NOTIFY)
-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)
-
/**
* @brief Convert an event response type to a label.
* @param type The event type.