[gnome-settings-daemon] wacom: Fix possible double-event generation
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Fix possible double-event generation
- Date: Thu, 23 Feb 2012 14:52:02 +0000 (UTC)
commit 8530df68d94dc9cd37d87c37444b725bca8eb926
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 23 15:49:54 2012 +0100
wacom: Fix possible double-event generation
Generate key press on button press, and key release on button
release. Also make sure to use the non-XI XTest functions, to
avoid keys not latching as expected.
See:
https://bugzilla.gnome.org/show_bug.cgi?id=670688
https://bugs.freedesktop.org/show_bug.cgi?id=46522
plugins/wacom/gsd-wacom-manager.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 8283554..e1144b9 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -710,8 +710,8 @@ send_modifiers (Display *display,
guint keycode;
keycode = XKeysymToKeycode (display, mods_keysyms[i].keysym);
- XTestFakeDeviceKeyEvent (display, dev, keycode,
- is_press ? True : False, NULL, 0, 0);
+ XTestFakeKeyEvent (display, keycode,
+ is_press ? True : False, 0);
}
}
}
@@ -794,17 +794,18 @@ filter_button_events (XEvent *xevent,
g_free (str);
return GDK_FILTER_REMOVE;
}
+ g_debug ("Emitting '%s' on device %d", str, deviceid);
g_free (str);
dev.device_id = deviceid; /* that's cheating, but whot did it first */
/* And send out the keys! */
- send_modifiers (xev->display, &dev, mods, TRUE);
- XTestFakeDeviceKeyEvent (xev->display, &dev, keycodes[0],
- True, NULL, 0, 0);
- XTestFakeDeviceKeyEvent (xev->display, &dev, keycodes[0],
- False, NULL, 0, 0);
- send_modifiers (xev->display, &dev, mods, FALSE);
+ if (xiev->evtype == XI_ButtonPress)
+ send_modifiers (xev->display, &dev, mods, TRUE);
+ XTestFakeKeyEvent (xev->display, keycodes[0],
+ xiev->evtype == XI_ButtonPress ? True : False, 0);
+ if (xiev->evtype == XI_ButtonRelease)
+ send_modifiers (xev->display, &dev, mods, FALSE);
g_free (keycodes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]