From: David Hill Date: Tue, 3 Jul 2012 19:51:50 +0000 (-0400) Subject: initial code to compile in xcb support. X-Git-Tag: SPECTRWM_1_2_0~221 X-Git-Url: https://code.delx.au/spectrwm/commitdiff_plain/e876d7de1335a16124065cabde4d51fd10cfca6f initial code to compile in xcb support. many more diffs coming. --- diff --git a/Makefile b/Makefile index e31cdb8..f61d5c5 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ CFLAGS+=-std=c89 -Wall -Wno-uninitialized -g # Uncomment define below to disallow user settable clock format string #CFLAGS+=-DSWM_DENY_CLOCK_FORMAT CPPFLAGS+= -I${X11BASE}/include -LDADD+=-lutil -L${X11BASE}/lib -lX11 -lXrandr -lXtst +LDADD+=-lutil -L${X11BASE}/lib -lX11-xcb -lXrandr -lXtst BUILDVERSION != sh "${.CURDIR}/buildver.sh" .if !${BUILDVERSION} == "" CPPFLAGS+= -DSPECTRWM_BUILDSTR=\"$(BUILDVERSION)\" diff --git a/spectrwm.c b/spectrwm.c index 5b97af2..225029b 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -90,7 +90,7 @@ #include #include #include -#include +#include #include #include #include @@ -221,6 +221,7 @@ int xrandr_support; int xrandr_eventbase; unsigned int numlockmask = 0; Display *display; +xcb_connection_t *conn; int cycle_empty = 0; int cycle_visible = 0; @@ -2159,6 +2160,7 @@ restart(struct swm_region *r, union arg *args) bar_extra_stop(); bar_extra = 1; unmap_all(); + xcb_disconnect(conn); XCloseDisplay(display); execvp(start_argv[0], start_argv); warn("execvp failed"); @@ -7418,6 +7420,9 @@ main(int argc, char *argv[]) if (!(display = XOpenDisplay(0))) errx(1, "can not open display"); + if (!(conn = XGetXCBConnection(display))) + errx(1, "can not get XCB connection"); + if (active_wm()) errx(1, "other wm running"); @@ -7597,6 +7602,7 @@ done: XFreeGC(display, screens[i].bar_gc); XFreeFontSet(display, bar_fs); + xcb_disconnect(conn); XCloseDisplay(display); return (0);