Module Name:    xsrc
Committed By:   mrg
Date:           Fri Jul 19 07:29:35 UTC 2019

Modified Files:
        xsrc/external/mit/xinput/dist/src: xinput.c

Log Message:
merge xinput 1.6.3


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xinput/dist/src/xinput.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xinput/dist/src/xinput.c
diff -u xsrc/external/mit/xinput/dist/src/xinput.c:1.4 xsrc/external/mit/xinput/dist/src/xinput.c:1.5
--- xsrc/external/mit/xinput/dist/src/xinput.c:1.4	Wed Jul 22 08:36:10 2015
+++ xsrc/external/mit/xinput/dist/src/xinput.c	Fri Jul 19 07:29:35 2019
@@ -273,7 +273,7 @@ find_device_info(Display	*display,
     return found;
 }
 
-#ifdef HAVE_XI2
+#if HAVE_XI2
 Bool is_pointer(int use)
 {
     return use == XIMasterPointer || use == XISlavePointer;
@@ -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,

Reply via email to