JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
replace XTestFakeButtonEvent with xcb
authorDavid Hill <dhill@conformal.com>
Fri, 13 Jul 2012 23:59:26 +0000 (19:59 -0400)
committerReginald Kennedy <rk@rejii.com>
Fri, 20 Jul 2012 21:59:28 +0000 (05:59 +0800)
Makefile
spectrwm.c

index 682238f..0095a31 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ CFLAGS+=-std=gnu89 -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-xcb -lxcb-aux -lxcb-keysyms -lxcb-randr -lxcb-icccm -lXrandr -lXtst
+LDADD+=-lutil -L${X11BASE}/lib -lX11-xcb -lxcb-aux -lxcb-icccm -lxcb-keysyms -lxcb-randr -lxcb-xtest -lXtst
 BUILDVERSION != sh "${.CURDIR}/buildver.sh"
 .if !${BUILDVERSION} == ""
 CPPFLAGS+= -DSPECTRWM_BUILDSTR=\"$(BUILDVERSION)\"
index 66566e8..783e429 100644 (file)
@@ -97,6 +97,7 @@
 #include <xcb/xcb_event.h>
 #include <xcb/xcb_icccm.h>
 #include <xcb/xcb_keysyms.h>
+#include <xcb/xtest.h>
 #include <X11/Xproto.h>
 #include <X11/Xutil.h>
 #include <X11/extensions/Xrandr.h>
@@ -2241,6 +2242,9 @@ fake_keypress(struct ws_win *win, xcb_keysym_t keysym, uint16_t modifiers)
 
        keycode = xcb_key_symbols_get_keycode(syms, keysym);
 
+       DNPRINTF(SWM_D_MISC, "fake_keypress: win 0x%x keycode %u\n",
+               win->id, *keycode);
+
        event.event = win->id;
        event.root = win->s->root;
        event.child = XCB_WINDOW_NONE;
@@ -3699,8 +3703,10 @@ send_to_ws(struct swm_region *r, union arg *args)
 void
 pressbutton(struct swm_region *r, union arg *args)
 {
-       XTestFakeButtonEvent(display, args->id, True, CurrentTime);
-       XTestFakeButtonEvent(display, args->id, False, CurrentTime);
+       xcb_test_fake_input(conn, XCB_BUTTON_PRESS, args->id,
+               XCB_CURRENT_TIME, XCB_WINDOW_NONE, 0, 0, 0);
+       xcb_test_fake_input(conn, XCB_BUTTON_RELEASE, args->id,
+               XCB_CURRENT_TIME, XCB_WINDOW_NONE, 0, 0, 0); 
 }
 
 void
@@ -6753,6 +6759,9 @@ keypress(xcb_key_press_event_t *e)
        struct swm_region       *r;
 
        keysym = XkbKeycodeToKeysym(display, (KeyCode)e->detail, 0, 0);
+
+       DNPRINTF(SWM_D_EVENT, "keypress: %u\n", e->detail);
+
        if ((kp = key_lookup(CLEANMASK(e->state), keysym)) == NULL)
                return;
        if (keyfuncs[kp->funcid].func == NULL)