Commit 852ed7c7 authored by Peter Hutterer's avatar Peter Hutterer

test-xi2: add support for test-xi2 --root

Select on the root window instead of a newly created one
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent d08c4278
......@@ -104,9 +104,11 @@ loop displaying events received. If the -proximity is given, ProximityIn
and ProximityOut are registered.
.PP
.TP 8
.B --test-xi2 [\fIdevice\fP]
.B --test-xi2 [--root] [\fIdevice\fP]
Register for a number of XI2 events and display them. If a device is given,
only events on this device are displayed.
only events on this device are displayed. If --root is given, events are
selected on the root window only. Otherwise, a new client window is created
(similar to xev).
.PP
.TP 8
.B --create-master \fIprefix\fP [sendCore] [enable]
......
......@@ -325,20 +325,32 @@ test_xi2(Display *display,
XIEventMask *m;
Window win;
int deviceid = -1;
int use_root = 0;
int rc;
setlinebuf(stdout);
if (argc >= 1 && strcmp(argv[0], "--root") == 0) {
use_root = 1;
argc--;
argv++;
}
rc = list(display, argc, argv, name, desc);
if (rc != EXIT_SUCCESS)
return rc;
if (use_root)
win = DefaultRootWindow(display);
else
win = create_win(display);
if (argc >= 1) {
XIDeviceInfo *info;
info = xi2_find_device_info(display, argv[0]);
deviceid = info->deviceid;
}
win = create_win(display);
/* Select for motion events */
m = &mask[0];
......@@ -379,15 +391,17 @@ test_xi2(Display *display,
XISetMask(m->mask, XI_RawTouchEnd);
#endif
XISelectEvents(display, win, &mask[0], 1);
XISelectEvents(display, DefaultRootWindow(display), &mask[1], 1);
XMapWindow(display, win);
XISelectEvents(display, win, &mask[0], use_root ? 2 : 1);
if (!use_root) {
XISelectEvents(display, DefaultRootWindow(display), &mask[1], 1);
XMapWindow(display, win);
}
XSync(display, False);
free(mask[0].mask);
free(mask[1].mask);
{
if (!use_root) {
XEvent event;
XMaskEvent(display, ExposureMask, &event);
XSelectInput(display, win, 0);
......
......@@ -101,7 +101,7 @@ static entry drivers[] =
set_clientpointer
},
{ "test-xi2",
"<device>",
"[--root] <device>",
test_xi2,
},
{ "map-to-output",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment