]> git.sur5r.net Git - i3/i3/commitdiff
Add conditional for the 0.3.3 → 0.3.4 API fix in libxcb-keysyms
authorMichael Stapelberg <michael+git@stapelberg.de>
Sun, 19 Apr 2009 19:37:34 +0000 (21:37 +0200)
committerMichael Stapelberg <michael+git@stapelberg.de>
Sun, 19 Apr 2009 19:37:34 +0000 (21:37 +0200)
Makefile
src/xcb.c

index dbe56b4baf538522751b8ff1f235fbe4f6d37f6f..bd4a8eca878b0a0b7590201e7a7bab46585bf5f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,12 @@ CFLAGS += -Iinclude
 CFLAGS += -I/usr/local/include
 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
 
+ifeq ($(shell pkg-config --exact-version=0.3.3 xcb-keysyms && echo 1),1)
+# xcb-keysyms fixed API from 0.3.3 to 0.3.4, so for some months, we will
+# have this here. Distributions should upgrade their libxcb in the meantime.
+CFLAGS += -DOLD_XCB_KEYSYMS_API
+endif
+
 LDFLAGS += -lm
 LDFLAGS += -lxcb-event
 LDFLAGS += -lxcb-property
index 15f977dca1e11f4598a5b973a70089d0398f3edb..0daf4b42d3174f43701314857e75f47c2f9df1a9 100644 (file)
--- a/src/xcb.c
+++ b/src/xcb.c
@@ -236,7 +236,7 @@ void xcb_get_numlock_mask(xcb_connection_t *conn) {
         xcb_key_symbols_t *keysyms;
         xcb_get_modifier_mapping_cookie_t cookie;
         xcb_get_modifier_mapping_reply_t *reply;
-        xcb_keycode_t *modmap, numlock;
+        xcb_keycode_t *modmap;
         int mask, i;
         const int masks[8] = { XCB_MOD_MASK_SHIFT,
                                XCB_MOD_MASK_LOCK,
@@ -261,7 +261,13 @@ void xcb_get_numlock_mask(xcb_connection_t *conn) {
         modmap = xcb_get_modifier_mapping_keycodes(reply);
 
         /* Get the keycode for numlock */
-        numlock = xcb_key_symbols_get_keycode(keysyms, XCB_NUM_LOCK);
+#ifdef OLD_XCB_KEYSYMS_API
+        xcb_keysym_t numlock = xcb_key_symbols_get_keycode(keysyms, XCB_NUM_LOCK);
+#else
+        /* For now, we only use the first keysymbol. */
+        xcb_keysym_t *numlock_syms = xcb_key_symbols_get_keycode(keysyms, XCB_NUM_LOCK);
+        xcb_keysym_t numlock = *numlock_syms;
+#endif
 
         /* Check all modifiers (Mod1-Mod5, Shift, Control, Lock) */
         for (mask = 0; mask < sizeof(masks); mask++)