summaryrefslogtreecommitdiff
path: root/setxkbmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'setxkbmap.c')
-rw-r--r--setxkbmap.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/setxkbmap.c b/setxkbmap.c
index d36ee75..21bb12f 100644
--- a/setxkbmap.c
+++ b/setxkbmap.c
@@ -1075,16 +1075,24 @@ is_xwayland(void)
Bool rc = False;
XRRScreenResources *resources = NULL;
XRROutputInfo *output = NULL;
+ int opcode, event_base, error_base, major, minor;
- /* There is no definitive way of checking for an Xwayland server,
- * but the two working methods are:
+ /* With Xwayland 23.1 and above, the definitive way of checking for an
+ * Xwayland server is to check for the "XWAYLAND" extension.
+ */
+ if (XQueryExtension(dpy, "XWAYLAND", &opcode, &event_base, &error_base)) {
+ rc = True;
+ goto out;
+ }
+
+ /* For previous versions of Xwayland, there is no definitive way of checking
+ * for an Xwayland server, but the two working methods are:
* - RandR output names in Xwayland are XWAYLAND0, XWAYLAND1, etc.
* - XI devices are xwayland-pointer:10, xwayland-keyboard:11
* Let's go with the XRandR check here because it's slightly less
* code to write.
*/
- int event_base, error_base, major, minor;
if (!XRRQueryExtension(dpy, &event_base, &error_base) ||
!XRRQueryVersion(dpy, &major, &minor)) {
/* e.g. Xnest, but definitely not Xwayland */