summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-08-19 13:16:17 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-08-19 16:34:17 +1000
commit32992f829262322a63e29b3118943e07481abb50 (patch)
tree2942e9c534e8422b7643b33d3fa4bfa3ccb2ed04
parentdcfa38899b2eae1beec9486063281ef0fb0bda76 (diff)
test-xi2: support a device option
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--man/xinput.man6
-rw-r--r--src/test_xi2.c13
2 files changed, 13 insertions, 6 deletions
diff --git a/man/xinput.man b/man/xinput.man
index 5470f29..085a5fc 100644
--- a/man/xinput.man
+++ b/man/xinput.man
@@ -104,9 +104,9 @@ loop displaying events received. If the -proximity is given, ProximityIn
and ProximityOut are registered.
.PP
.TP 8
-.B --test-xi2
-Register for a number of XI2 events and display them. This option does not
-take a device argument.
+.B --test-xi2 [\fIdevice\fP]
+Register for a number of XI2 events and display them. If a device is given,
+only events on this device are displayed.
.PP
.TP 8
.B --create-master \fIprefix\fP [sendCore] [enable]
diff --git a/src/test_xi2.c b/src/test_xi2.c
index 619a6b2..92c88da 100644
--- a/src/test_xi2.c
+++ b/src/test_xi2.c
@@ -306,12 +306,18 @@ test_xi2(Display *display,
{
XIEventMask mask;
Window win;
+ int deviceid = -1;
list(display, argc, argv, name, desc);
+ if (argc >= 1) {
+ XIDeviceInfo *info;
+ info = xi2_find_device_info(display, argv[0]);
+ deviceid = info->deviceid;
+ }
win = create_win(display);
/* Select for motion events */
- mask.deviceid = XIAllDevices;
+ mask.deviceid = (deviceid == -1) ? XIAllDevices : deviceid;
mask.mask_len = XIMaskLen(XI_RawMotion);
mask.mask = calloc(mask.mask_len, sizeof(char));
XISetMask(mask.mask, XI_ButtonPress);
@@ -324,7 +330,8 @@ test_xi2(Display *display,
XISetMask(mask.mask, XI_Leave);
XISetMask(mask.mask, XI_FocusIn);
XISetMask(mask.mask, XI_FocusOut);
- XISetMask(mask.mask, XI_HierarchyChanged);
+ if (mask.deviceid == XIAllDevices)
+ XISetMask(mask.mask, XI_HierarchyChanged);
XISetMask(mask.mask, XI_PropertyEvent);
XISelectEvents(display, win, &mask, 1);
XMapWindow(display, win);
@@ -349,7 +356,7 @@ test_xi2(Display *display,
XIUngrabKeycode(display, 3, 24 /* q */, win, nmods - 2, &modifiers[2]);
}
- mask.deviceid = XIAllMasterDevices;
+ mask.deviceid = (deviceid == -1) ? XIAllMasterDevices : deviceid;
memset(mask.mask, 0, mask.mask_len);
XISetMask(mask.mask, XI_RawKeyPress);
XISetMask(mask.mask, XI_RawKeyRelease);