diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-07-27 21:15:31 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-07-27 21:15:31 -0400 |
commit | c0e09be4086e76866e9ff22bfc02e5e96bd80a44 (patch) | |
tree | 0be8a4354b8ba8f5fb8d6e2bd74ee72f46699599 /src | |
parent | dabd471bffe1f772c3cf4770dffbce240761917d (diff) |
Add support for an Xlib display pointer.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/app.h | 6 | ||||
-rw-r--r-- | src/conn.c | 26 | ||||
-rw-r--r-- | src/propmon.c | 2 | ||||
-rw-r--r-- | src/selmgr.c | 2 | ||||
-rw-r--r-- | src/selmon.c | 2 |
6 files changed, 26 insertions, 16 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 3009a4f..eca067a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,7 @@ pkgpythondir = $(pythondir)/xcb bin_PROGRAMS = sedpymgr sedpymgr_SOURCES = main.c selmon.c selmgr.c propmon.c atom.c conn.c util.c -sedpymgr_CFLAGS = $(GTK_CFLAGS) -sedpymgr_LDADD = $(GTK_LIBS) $(XFIXES_LIBS) $(XSELINUX_LIBS) -lselinux +sedpymgr_CFLAGS = $(SEDPYMGR_CFLAGS) +sedpymgr_LDADD = $(SEDPYMGR_LIBS) noinst_HEADERS = app.h @@ -7,6 +7,8 @@ #include <xcb/xproto.h> #include <xcb/xfixes.h> #include <xcb/xselinux.h> +#include <X11/Xlib.h> +#include <X11/Xlib-xcb.h> #include <gtk/gtk.h> enum { @@ -81,8 +83,8 @@ void selection_register(xcb_connection_t *conn, xcb_window_t window); /* conn.c */ -xcb_connection_t * -make_connection(const gchar *display); +void +make_connection(const gchar *name, xcb_connection_t **conn, Display **dpy); int fetch_property_data(xcb_connection_t *conn, @@ -52,18 +52,26 @@ check_xselinux(xcb_connection_t *conn) free(version); } -xcb_connection_t * -make_connection(const gchar *display) +void +make_connection(const gchar *name, xcb_connection_t **conn, Display **dpy) { - xcb_connection_t *conn = xcb_connect(display, NULL); - if (xcb_connection_has_error(conn)) + Display *td; + xcb_connection_t *tc; + + td = XOpenDisplay(name); + if (!td) APP_ERR(NULL, "could not connect to X display\n"); - xcb_prefetch_extension_data(conn, &xcb_xfixes_id); - xcb_prefetch_extension_data(conn, &xcb_selinux_id); - check_xfixes(conn); - check_xselinux(conn); - return conn; + tc = XGetXCBConnection(td); + xcb_prefetch_extension_data(tc, &xcb_xfixes_id); + xcb_prefetch_extension_data(tc, &xcb_selinux_id); + check_xfixes(tc); + check_xselinux(tc); + + if (conn) + *conn = tc; + if (dpy) + *dpy = td; } int diff --git a/src/propmon.c b/src/propmon.c index 96182db..85f6cee 100644 --- a/src/propmon.c +++ b/src/propmon.c @@ -16,7 +16,7 @@ setup_x(const gchar *display) xcb_screen_iterator_t iter; uint32_t mask, list; - conn = make_connection(display); + make_connection(display, &conn, NULL); setup = xcb_get_setup(conn); iter = xcb_setup_roots_iterator(setup); diff --git a/src/selmgr.c b/src/selmgr.c index 5908f5c..7ac4a95 100644 --- a/src/selmgr.c +++ b/src/selmgr.c @@ -52,7 +52,7 @@ setup_x(const gchar *display) xcb_screen_iterator_t iter; xcb_window_t root; - conn = make_connection(display); + make_connection(display, &conn, NULL); xfixes_type = xcb_get_extension_data(conn, &xcb_xfixes_id)->first_event; setup = xcb_get_setup(conn); diff --git a/src/selmon.c b/src/selmon.c index 9f4b1b5..92c864d 100644 --- a/src/selmon.c +++ b/src/selmon.c @@ -41,7 +41,7 @@ setup_x(const gchar *display) xcb_screen_iterator_t iter; xcb_window_t root; - conn = make_connection(display); + make_connection(display, &conn, NULL); xfixes_type = xcb_get_extension_data(conn, &xcb_xfixes_id)->first_event; setup = xcb_get_setup(conn); |