summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-03-26 16:06:44 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2019-03-27 09:31:35 +1000
commitd0a77e79a73177090ae7dceb7a9802f98db6d9f0 (patch)
treeb7682d301cc75c82578e92a170ec143f54cd6b63
parentc7ca2b99c099456d0c0e83309d6f426c5feacb25 (diff)
Warn if you're running against an XWayland server
Because there's a 99% chance you don't want this. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--man/xinput.man18
-rw-r--r--src/xinput.c23
2 files changed, 41 insertions, 0 deletions
diff --git a/man/xinput.man b/man/xinput.man
index b89fb01..a9b2148 100644
--- a/man/xinput.man
+++ b/man/xinput.man
@@ -178,6 +178,24 @@ by the new value(s) of the property. For example:
.IP
\fBxinput set-prop "my device" "my prop" 1 2 3\fB
+.SH "XWAYLAND"
+Xwayland is an X server that uses a Wayland Compositor as backend.
+Xwayland acts as translation layer between the X protocol and the Wayland
+protocol but does not have direct access to the hardware. The X Input
+Extension devices created by Xwayland ("xwayland-pointer",
+"xwayland-keyboard", etc.) map to the Wayland protocol devices,
+not to physical devices.
+.PP
+These X Input Extension devices are only visible to other X clients
+connected to the same Xwayland process. Changing properties on Xwayland
+devices only affects the behavior of those clients. For example, disabling
+an Xwayland device with xinput does not disable the device in Wayland-native
+applications. Other changes may not have any effect at all.
+.PP
+In most instances, using xinput with an Xwayland device is indicative of a
+bug in a shell script and xinput will print a warning. Use the Wayland
+Compositor's native device configuration methods instead.
+
.SH "SEE ALSO"
X(__miscmansuffix__), xset(__appmansuffix__), xrandr(__appmansuffix__)
.SH COPYRIGHT
diff --git a/src/xinput.c b/src/xinput.c
index 5dd2766..7b27ffe 100644
--- a/src/xinput.c
+++ b/src/xinput.c
@@ -361,6 +361,26 @@ usage(void)
}
}
+static Bool
+is_xwayland(Display *dpy)
+{
+ XDeviceInfo *devices;
+ int n;
+ Bool is_xwayland = False;
+
+ devices = XListInputDevices(dpy, &n);
+ while (n-- > 0) {
+ if (strncmp(devices[n].name, "xwayland-", 9) == 0) {
+ is_xwayland = True;
+ break;
+ }
+ }
+
+ XFreeDeviceList(devices);
+
+ return is_xwayland;
+}
+
int
main(int argc, char * argv[])
{
@@ -402,6 +422,9 @@ main(int argc, char * argv[])
goto out;
}
+ if (is_xwayland(display))
+ fprintf(stderr, "WARNING: running xinput against an Xwayland server. See the xinput man page for details.\n");
+
while(driver->func_name) {
if (strcmp(driver->func_name, func) == 0) {
int r = (*driver->func)(display, argc-2, argv+2,