]> diplodocus.org Git - xorg-xinput/commitdiff
Warn if you're running against an XWayland server
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 26 Mar 2019 06:06:44 +0000 (16:06 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 26 Mar 2019 23:31:35 +0000 (09:31 +1000)
Because there's a 99% chance you don't want this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
man/xinput.man
src/xinput.c

index b89fb01..a9b2148 100644 (file)
@@ -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
index 5dd2766..7b27ffe 100644 (file)
@@ -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,