summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2009-04-03 17:02:57 +0200
committerJulien Danjou <julien@danjou.info>2009-04-03 17:02:57 +0200
commit57816a46aa32d0bd667661ce6aaaa187f84ec889 (patch)
treed5b09c5af774ed52100d5a91f154b393dec29e05
parentfc0f1dac23320c2cf9dab6e5023e74e9aa0e3132 (diff)
downloadstartup-notification-57816a46aa32d0bd667661ce6aaaa187f84ec889.tar.gz
XCB is no more an option
This is the simplest way to have an ABI which does not depend on a compilation option, which is bad. Signed-off-by: Julien Danjou <julien@danjou.info>
-rw-r--r--configure.in22
-rw-r--r--libsn/sn-common.c32
-rw-r--r--libsn/sn-common.h13
-rw-r--r--libsn/sn-internals.h4
-rw-r--r--libsn/sn-xmessages.c8
-rw-r--r--libsn/sn-xutils.c10
-rw-r--r--test/Makefile.am6
7 files changed, 9 insertions, 86 deletions
diff --git a/configure.in b/configure.in
index 398efa0..21fe138 100644
--- a/configure.in
+++ b/configure.in
@@ -78,20 +78,14 @@ fi
## try definining HAVE_BACKTRACE
AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
-AC_ARG_WITH([xcb], AS_HELP_STRING([--with-xcb], [build with XCB library]))
-
-if test "x$with_xcb" = "xyes"; then
- PKG_CHECK_MODULES([xcb], [xcb],,
- [AC_MSG_ERROR([Cannot find xcb])])
- PKG_CHECK_MODULES([xcb_aux], [xcb-aux],,
- [AC_MSG_ERROR([Cannot find xcb-aux])])
- PKG_CHECK_MODULES([xcb_event], [xcb-event],,
- [AC_MSG_ERROR([Cannot find xcb-event])])
- PKG_CHECK_MODULES([xcb_atom], [xcb-atom],,
- [AC_MSG_ERROR([Cannot find xcb-atom])])
- AC_DEFINE([HAVE_XCB],1,[Defined to use xcb])
-fi
-AM_CONDITIONAL(WITH_XCB, test "x$with_xcb" = "xyes")
+PKG_CHECK_MODULES([xcb], [xcb],,
+ [AC_MSG_ERROR([Cannot find xcb])])
+PKG_CHECK_MODULES([xcb_aux], [xcb-aux],,
+ [AC_MSG_ERROR([Cannot find xcb-aux])])
+PKG_CHECK_MODULES([xcb_event], [xcb-event],,
+ [AC_MSG_ERROR([Cannot find xcb-event])])
+PKG_CHECK_MODULES([xcb_atom], [xcb-atom],,
+ [AC_MSG_ERROR([Cannot find xcb-atom])])
LIBSN_CFLAGS="$X_CFLAGS $xcb_CFLAGS $xcb_aux_CFLAGS $xcb_event_CFLAGS $xcb_atom_CFLAGS"
LIBSN_LIBS=" $xcb_LIBS $xcb_aux_LIBS $xcb_event_LIBS $xcb_atom_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
diff --git a/libsn/sn-common.c b/libsn/sn-common.c
index 66ca2b6..ea39b5d 100644
--- a/libsn/sn-common.c
+++ b/libsn/sn-common.c
@@ -27,10 +27,8 @@
#include "sn-common.h"
#include "sn-internals.h"
-#ifdef HAVE_XCB
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
-#endif
struct SnDisplay
{
@@ -45,7 +43,6 @@ struct SnDisplay
SnDisplayErrorTrapPush push_trap_func;
SnDisplayErrorTrapPop pop_trap_func;
} xlib;
-#ifdef HAVE_XCB
struct
{
xcb_connection_t *xconnection;
@@ -53,7 +50,6 @@ struct SnDisplay
SnXcbDisplayErrorTrapPush push_trap_func;
SnXcbDisplayErrorTrapPop pop_trap_func;
} xcb;
-#endif
} x;
int n_screens;
SnList *xmessage_funcs;
@@ -104,7 +100,6 @@ sn_display_new (Display *xdisplay,
return display;
}
-#ifdef HAVE_XCB
/**
* sn_xcb_display_new:
* @xdisplay: an X window system display
@@ -148,7 +143,6 @@ sn_xcb_display_new (xcb_connection_t *xconnection,
return display;
}
-#endif
/**
* sn_display_ref:
@@ -179,19 +173,15 @@ sn_display_unref (SnDisplay *display)
sn_list_free (display->xmessage_funcs);
if (display->pending_messages)
sn_list_free (display->pending_messages);
-#ifdef HAVE_XCB
switch (display->type)
{
case SN_DISPLAY_TYPE_XCB:
sn_free (display->x.xcb.screens);
break;
case SN_DISPLAY_TYPE_XLIB:
-#endif
sn_free (display->x.xlib.screens);
-#ifdef HAVE_XCB
break;
}
-#endif
sn_free (display);
}
}
@@ -212,7 +202,6 @@ sn_display_get_x_display (SnDisplay *display)
return NULL;
}
-#ifdef HAVE_XCB
/**
* sn_display_get_x_connection:
* @display: an #SnDisplay
@@ -228,7 +217,6 @@ sn_display_get_x_connection(SnDisplay *display)
return display->x.xcb.xconnection;
return NULL;
}
-#endif
/**
* sn_internal_display_get_id:
@@ -241,18 +229,14 @@ sn_display_get_x_connection(SnDisplay *display)
void *
sn_internal_display_get_id (SnDisplay *display)
{
-#ifdef HAVE_XCB
switch (display->type)
{
case SN_DISPLAY_TYPE_XLIB:
-#endif
return display->x.xlib.xdisplay;
-#ifdef HAVE_XCB
case SN_DISPLAY_TYPE_XCB:
return display->x.xcb.xconnection;
}
return NULL;
-#endif
}
/**
@@ -290,17 +274,13 @@ sn_internal_display_get_root_window (SnDisplay *display,
int number)
{
if (number >= 0 && number < display->n_screens)
-#ifdef HAVE_XCB
switch (display->type)
{
case SN_DISPLAY_TYPE_XLIB:
-#endif
return RootWindow (display->x.xlib.xdisplay, number);
-#ifdef HAVE_XCB
case SN_DISPLAY_TYPE_XCB:
return display->x.xcb.screens[number]->root;
}
-#endif
return None;
}
@@ -318,7 +298,6 @@ sn_internal_display_get_type (SnDisplay *display)
return display->type;
}
-#ifdef HAVE_XCB
/**
* sn_internal_display_get_x_screen:
* @display: an #SnDisplay
@@ -338,7 +317,6 @@ sn_internal_display_get_xcb_screen (SnDisplay *display,
else
return display->x.xcb.screens[number];
}
-#endif
/**
* sn_internal_display_get_screen_number:
@@ -387,7 +365,6 @@ sn_display_process_event (SnDisplay *display,
return retval;
}
-#ifdef HAVE_XCB
/**
* sn_xcb_display_process_event:
* @display: a display
@@ -420,7 +397,6 @@ sn_xcb_display_process_event (SnDisplay *display,
return retval;
}
-#endif
/**
* sn_display_error_trap_push:
@@ -431,7 +407,6 @@ sn_xcb_display_process_event (SnDisplay *display,
void
sn_display_error_trap_push (SnDisplay *display)
{
-#ifdef HAVE_XCB
switch (display->type)
{
case SN_DISPLAY_TYPE_XCB:
@@ -439,13 +414,10 @@ sn_display_error_trap_push (SnDisplay *display)
(* display->x.xcb.push_trap_func) (display, display->x.xcb.xconnection);
break;
case SN_DISPLAY_TYPE_XLIB:
-#endif
if (display->x.xlib.push_trap_func)
(* display->x.xlib.push_trap_func) (display, display->x.xlib.xdisplay);
-#ifdef HAVE_XCB
break;
}
-#endif
}
/**
@@ -457,7 +429,6 @@ sn_display_error_trap_push (SnDisplay *display)
void
sn_display_error_trap_pop (SnDisplay *display)
{
-#ifdef HAVE_XCB
switch (display->type)
{
case SN_DISPLAY_TYPE_XCB:
@@ -465,13 +436,10 @@ sn_display_error_trap_pop (SnDisplay *display)
(* display->x.xcb.pop_trap_func) (display, display->x.xcb.xconnection);
break;
case SN_DISPLAY_TYPE_XLIB:
-#endif
if (display->x.xlib.pop_trap_func)
(* display->x.xlib.pop_trap_func) (display, display->x.xlib.xdisplay);
-#ifdef HAVE_XCB
break;
}
-#endif
}
void
diff --git a/libsn/sn-common.h b/libsn/sn-common.h
index 8fa34e8..083fa2d 100644
--- a/libsn/sn-common.h
+++ b/libsn/sn-common.h
@@ -28,15 +28,12 @@
#include <libsn/sn-util.h>
#include <X11/Xlib.h>
+#include <xcb/xcb.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#ifdef HAVE_XCB
-#include <xcb/xcb.h>
-#endif
-
SN_BEGIN_DECLS
#ifndef SN_API_NOT_YET_FROZEN
@@ -50,36 +47,28 @@ typedef void (* SnDisplayErrorTrapPush) (SnDisplay *display,
typedef void (* SnDisplayErrorTrapPop) (SnDisplay *display,
Display *xdisplay);
-#ifdef HAVE_XCB
typedef void (* SnXcbDisplayErrorTrapPush) (SnDisplay *display,
xcb_connection_t *xconnection);
typedef void (* SnXcbDisplayErrorTrapPop) (SnDisplay *display,
xcb_connection_t *xconnection);
-#endif
SnDisplay* sn_display_new (Display *xdisplay,
SnDisplayErrorTrapPush push_trap_func,
SnDisplayErrorTrapPop pop_trap_func);
-#ifdef HAVE_XCB
SnDisplay* sn_xcb_display_new (xcb_connection_t *xconnection,
SnXcbDisplayErrorTrapPush push_trap_func,
SnXcbDisplayErrorTrapPop pop_trap_func);
-#endif
void sn_display_ref (SnDisplay *display);
void sn_display_unref (SnDisplay *display);
Display* sn_display_get_x_display (SnDisplay *display);
-#ifdef HAVE_XCB
xcb_connection_t* sn_display_get_x_connection (SnDisplay *display);
-#endif
sn_bool_t sn_display_process_event (SnDisplay *display,
XEvent *xevent);
-#ifdef HAVE_XCB
sn_bool_t sn_xcb_display_process_event (SnDisplay *display,
xcb_generic_event_t *xevent);
-#endif
void sn_display_error_trap_push (SnDisplay *display);
void sn_display_error_trap_pop (SnDisplay *display);
diff --git a/libsn/sn-internals.h b/libsn/sn-internals.h
index 1024d0b..1f7c792 100644
--- a/libsn/sn-internals.h
+++ b/libsn/sn-internals.h
@@ -65,10 +65,8 @@ int sn_internal_display_get_screen_number (SnDisplay *display);
void* sn_internal_display_get_id (SnDisplay *display);
-#ifdef HAVE_XCB
xcb_screen_t* sn_internal_display_get_xcb_screen (SnDisplay *display,
int number);
-#endif
enum SnDisplayType sn_internal_display_get_type (SnDisplay *display);
@@ -100,10 +98,8 @@ void sn_internal_append_to_string (char **append_to,
sn_bool_t sn_internal_xmessage_process_event (SnDisplay *display,
XEvent *xevent);
-#ifdef HAVE_XCB
sn_bool_t sn_xcb_internal_xmessage_process_event (SnDisplay *display,
xcb_generic_event_t *xevent);
-#endif
SN_END_DECLS
diff --git a/libsn/sn-xmessages.c b/libsn/sn-xmessages.c
index 1e1653b..ef18027 100644
--- a/libsn/sn-xmessages.c
+++ b/libsn/sn-xmessages.c
@@ -25,9 +25,7 @@
#include <config.h>
-#ifdef HAVE_XCB
#include <xcb/xcb_event.h>
-#endif
#include "sn-xmessages.h"
#include "sn-list.h"
@@ -160,11 +158,9 @@ sn_internal_broadcast_xmessage (SnDisplay *display,
return;
}
-#ifdef HAVE_XCB
switch (sn_internal_display_get_type (display))
{
case SN_DISPLAY_TYPE_XLIB:
-#endif
{
Atom type_atom;
Atom type_atom_begin;
@@ -230,7 +226,6 @@ sn_internal_broadcast_xmessage (SnDisplay *display,
XDestroyWindow (xdisplay, xwindow);
XFlush (xdisplay);
}
-#ifdef HAVE_XCB
break;
case SN_DISPLAY_TYPE_XCB:
{
@@ -290,7 +285,6 @@ sn_internal_broadcast_xmessage (SnDisplay *display,
}
break;
}
-#endif
}
typedef struct
@@ -566,7 +560,6 @@ sn_internal_xmessage_process_event (SnDisplay *display,
return retval;
}
-#ifdef HAVE_XCB
sn_bool_t
sn_xcb_internal_xmessage_process_event (SnDisplay *display,
xcb_generic_event_t *xevent)
@@ -596,7 +589,6 @@ sn_xcb_internal_xmessage_process_event (SnDisplay *display,
return retval;
}
-#endif
static void
sn_internal_append_to_string_escaped (char **append_to,
diff --git a/libsn/sn-xutils.c b/libsn/sn-xutils.c
index 1fece87..220f50e 100644
--- a/libsn/sn-xutils.c
+++ b/libsn/sn-xutils.c
@@ -27,30 +27,24 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
-#ifdef HAVE_XCB
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
-#endif
Atom
sn_internal_atom_get (SnDisplay *display,
const char *atom_name)
{
-#ifdef HAVE_XCB
switch (sn_internal_display_get_type (display))
{
case SN_DISPLAY_TYPE_XLIB:
-#endif
return XInternAtom (sn_display_get_x_display (display),
atom_name,
False);
-#ifdef HAVE_XCB
case SN_DISPLAY_TYPE_XCB:
return xcb_atom_get (sn_display_get_x_connection (display),
atom_name);
}
return None;
-#endif
}
void
@@ -61,18 +55,15 @@ sn_internal_set_utf8_string (SnDisplay *display,
{
sn_display_error_trap_push (display);
-#ifdef HAVE_XCB
switch (sn_internal_display_get_type (display))
{
case SN_DISPLAY_TYPE_XLIB:
-#endif
XChangeProperty (sn_display_get_x_display (display),
xwindow,
sn_internal_atom_get (display, property),
sn_internal_atom_get (display, "UTF8_STRING"),
8, PropModeReplace, (unsigned char*) str,
strlen (str));
-#ifdef HAVE_XCB
break;
case SN_DISPLAY_TYPE_XCB:
xcb_change_property (sn_display_get_x_connection (display),
@@ -83,7 +74,6 @@ sn_internal_set_utf8_string (SnDisplay *display,
8, strlen (str), str);
break;
}
-#endif
sn_display_error_trap_pop (display);
}
diff --git a/test/Makefile.am b/test/Makefile.am
index 88d066d..962970a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -16,11 +16,7 @@ XCB_TEST= \
test-launcher-xcb \
test-watch-xmessages-xcb
-if WITH_XCB
noinst_PROGRAMS=$(XLIB_TEST) $(XCB_TEST)
-else
-noinst_PROGRAMS=$(XLIB_TEST)
-endif
test_launcher_SOURCES= test-launcher.c
@@ -42,7 +38,6 @@ test_watch_xmessages_SOURCES= test-watch-xmessages.c
test_watch_xmessages_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
-if WITH_XCB
test_watch_xmessages_xcb_SOURCES= test-watch-xmessages-xcb.c
test_watch_xmessages_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
@@ -62,6 +57,5 @@ test_launchee_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notifica
test_launcher_xcb_SOURCES= test-launcher-xcb.c
test_launcher_xcb_LDADD= $(LIBSN_LIBS) $(top_builddir)/libsn/libstartup-notification-1.la
-endif
EXTRA_DIST=test-boilerplate.h