From 54c8d5ffa90e5b0a7e54228b518ebe67d87f8d2c Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 13 Jul 2012 19:59:26 -0400 Subject: [PATCH] replace XTestFakeButtonEvent with xcb --- Makefile | 2 +- spectrwm.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 682238f..0095a31 100644 --- 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)\" diff --git a/spectrwm.c b/spectrwm.c index 66566e8..783e429 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -97,6 +97,7 @@ #include #include #include +#include #include #include #include @@ -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) -- 1.7.10.4