]> git.sur5r.net Git - i3/i3/commitdiff
Remove dependency on xcb-event (Thanks Felicitus)
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 4 May 2011 17:33:43 +0000 (19:33 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 4 May 2011 17:33:43 +0000 (19:33 +0200)
common.mk
i3-input/main.c
include/i3.h
src/sighandler.c

index bfa6f80b162484df6d954e37e4e33bc4ab6fbe90..ce2a59b1dd940ae33c3d7979a91ac6ad1919a7e7 100644 (file)
--- a/common.mk
+++ b/common.mk
@@ -37,12 +37,12 @@ CFLAGS += -DOLD_XCB_KEYSYMS_API
 endif
 
 LDFLAGS += -lm
-LDFLAGS += -lxcb-event
 LDFLAGS += -lxcb-keysyms
 ifeq ($(shell pkg-config --exists xcb-util || echo 1),1)
 CFLAGS += -DXCB_COMPAT
 LDFLAGS += -lxcb-atom
 LDFLAGS += -lxcb-aux
+LDFLAGS += -lxcb-event
 else
 LDFLAGS += -lxcb-util
 endif
index fc9afd30baf0f3c566e82d82800bf34db0316cd7..cfae5bf8caeaa2610cc08e1e1e6d1fe948f808a1 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <xcb/xcb.h>
 #include <xcb/xcb_aux.h>
-#include <xcb/xcb_event.h>
 #include <xcb/xcb_keysyms.h>
 
 #include <X11/keysym.h>
index f081a1295b9f093165e40c9f670c42730063c093..0012e53fb04d08a441a882606edecd3f8edeacdb 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 #include <xcb/xcb.h>
-#include <xcb/xcb_property.h>
 #include <xcb/xcb_keysyms.h>
 
 #include <X11/XKBlib.h>
index 162edbc8e4a7c25b2355d7139662c14d5077d064..17fbe5d19015acc4065123f60ebea4e1a5c19452 100644 (file)
@@ -156,12 +156,6 @@ void handle_signal(int sig, siginfo_t *info, void *data) {
 
         xcb_connection_t *conn = global_conn;
 
-        /* setup event handler for key presses */
-        xcb_event_handlers_t sig_evenths;
-        memset(&sig_evenths, 0, sizeof(xcb_event_handlers_t));
-        xcb_event_handlers_init(conn, &sig_evenths);
-        xcb_event_set_key_press_handler(&sig_evenths, sig_handle_key_press, NULL);
-
         i3Font *font = load_font(conn, config.font);
 
         /* width and height of the popup window, so that the text fits in */
@@ -202,7 +196,16 @@ void handle_signal(int sig, siginfo_t *info, void *data) {
                 xcb_flush(conn);
         }
 
-        xcb_event_wait_for_event_loop(&sig_evenths);
+        xcb_generic_event_t *event;
+        /* Yay, more own eventhandlers… */
+        while ((event = xcb_wait_for_event(conn))) {
+                /* Strip off the highest bit (set if the event is generated) */
+                int type = (event->response_type & 0x7F);
+                if (type == XCB_KEY_PRESS) {
+                        sig_handle_key_press(NULL, conn, (xcb_key_press_event_t*)event);
+                }
+                free(event);
+        }
 }
 
 /*