summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2022-07-29 09:46:34 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2022-08-05 09:51:54 +1000
commitad6412624ef6dc4d7548fe16c254c4166ffa7198 (patch)
treeca8c6ba8ca5740c68a5c5f8454af79c22772dfa7
parenta3f847b75025a57b64967d08a299bc752c488aee (diff)
Add the XWAYLAND extension
This extension exists to serve one purpose: reliably identifying Xwayland. Previous attempts at doing so included querying root window properties, output names or input device names. All these attempts are somewhat unreliable. Instead, let's use an extension - where that extension is present we have an Xwayland server. Clients should never need to do anything but check whether the extension exists through XQueryExtension/XListExtensions. This extension provides a single QueryVersion request only, and that is only to provide future compatibility if we ever need anything other than "this extension exists" functionality. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
-rw-r--r--COPYING-xwaylandproto19
-rw-r--r--Makefile.am11
-rw-r--r--configure.ac3
-rw-r--r--include/X11/extensions/meson.build1
-rw-r--r--include/X11/extensions/xwaylandproto.h63
-rw-r--r--meson.build4
-rw-r--r--xwaylandproto.pc.in7
-rw-r--r--xwaylandproto.txt96
8 files changed, 201 insertions, 3 deletions
diff --git a/COPYING-xwaylandproto b/COPYING-xwaylandproto
new file mode 100644
index 0000000..727a530
--- /dev/null
+++ b/COPYING-xwaylandproto
@@ -0,0 +1,19 @@
+Copyright 2022 Red Hat, Inc.
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and
+that the name of the copyright holders not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission. The copyright holders make no representations
+about the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+OF THIS SOFTWARE.
diff --git a/Makefile.am b/Makefile.am
index 3d59178..e25650f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -326,6 +326,13 @@ xinerama_HEADERS = \
xineramaprotopkgconfigdir = $(datadir)/pkgconfig
xineramaprotopkgconfig_DATA = xineramaproto.pc
+xwaylandprotodir = $(includedir)/X11/extensions
+xwaylandproto_HEADERS = \
+ include/X11/extensions/xwaylandproto.h
+
+xwaylandprotopkgconfigdir = $(datadir)/pkgconfig
+xwaylandprotopkgconfig_DATA = xwaylandproto.pc
+
if LEGACY
XCalibrateincludedir = $(includedir)/X11/extensions
XCalibrateinclude_HEADERS = \
@@ -430,7 +437,8 @@ dist_doc_DATA = \
randrproto.txt \
renderproto.txt \
resproto.txt \
- xv-protocol-v2.txt
+ xv-protocol-v2.txt \
+ xwaylandproto.txt
EXTRA_DIST = \
COPYING-applewmproto \
@@ -469,6 +477,7 @@ EXTRA_DIST = \
COPYING-xf86rushproto \
COPYING-xf86vidmodeproto \
COPYING-xineramaproto \
+ COPYING-xwaylandproto \
README.md \
autogen.sh \
include/GL/internal/meson.build \
diff --git a/configure.ac b/configure.ac
index fa064f6..79464e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,7 @@ AC_CONFIG_FILES([applewmproto.pc
xf86vidmodeproto.pc
xineramaproto.pc
xproto.pc
- xproxymngproto.pc])
+ xproxymngproto.pc
+ xwaylandproto.pc])
AC_OUTPUT
diff --git a/include/X11/extensions/meson.build b/include/X11/extensions/meson.build
index d1ac281..9c91f22 100644
--- a/include/X11/extensions/meson.build
+++ b/include/X11/extensions/meson.build
@@ -87,6 +87,7 @@ install_headers(
'XvMC.h',
'XvMCproto.h',
'Xvproto.h',
+ 'xwaylandproto.h',
subdir : 'X11/extensions'
)
diff --git a/include/X11/extensions/xwaylandproto.h b/include/X11/extensions/xwaylandproto.h
new file mode 100644
index 0000000..49f048d
--- /dev/null
+++ b/include/X11/extensions/xwaylandproto.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2022 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _XWAYLAND_PROTO_H_
+#define _XWAYLAND_PROTO_H_
+
+#include <X11/Xproto.h>
+
+#define XWAYLAND_EXTENSION_NAME "XWAYLAND"
+#define XWAYLAND_EXTENSION_MAJOR 1
+#define XWAYLAND_EXTENSION_MINOR 0
+
+/* Request opcodes */
+#define X_XwlQueryVersion 0
+
+#define XwlNumberRequests 1
+#define XwlNumberErrors 0
+#define XwlNumberEvents 0
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 xwlReqType;
+ CARD16 length;
+ CARD16 majorVersion;
+ CARD16 minorVersion;
+} xXwlQueryVersionReq;
+#define sz_xXwlQueryVersionReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD16 majorVersion;
+ CARD16 minorVersion;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xXwlQueryVersionReply;
+#define sz_xXwlQueryVersionReply 32
+
+#endif
diff --git a/meson.build b/meson.build
index 7e02ac5..cee73de 100644
--- a/meson.build
+++ b/meson.build
@@ -51,6 +51,7 @@ pcs = [
'xf86vidmodeproto',
'xineramaproto',
'xproto',
+ 'xwaylandproto',
]
pc_data = configuration_data()
@@ -78,7 +79,8 @@ docs = files('compositeproto.txt',
'randrproto.txt',
'renderproto.txt',
'resproto.txt',
- 'xv-protocol-v2.txt')
+ 'xv-protocol-v2.txt',
+ 'xwaylandproto.txt')
install_data(docs,
install_dir: get_option('datadir') / 'doc' / 'xorgproto')
diff --git a/xwaylandproto.pc.in b/xwaylandproto.pc.in
new file mode 100644
index 0000000..16fccc7
--- /dev/null
+++ b/xwaylandproto.pc.in
@@ -0,0 +1,7 @@
+prefix=@prefix@
+includedir=@includedir@
+
+Name: XwaylandProto
+Description: Xwayland extension headers
+Version: 1.0
+Cflags: -I${includedir}
diff --git a/xwaylandproto.txt b/xwaylandproto.txt
new file mode 100644
index 0000000..25fdf87
--- /dev/null
+++ b/xwaylandproto.txt
@@ -0,0 +1,96 @@
+ The XWAYLAND Extension
+ Version 1.0
+ 2022-07-29
+
+1. Introduction
+
+The XWAYLAND extension allows clients to reliably identify whether an X server
+is Xwayland. It does not provide any functionality beyond the absolute minimum
+to identify as extension.
+
+Only Xwayland initializes this extension. Thus, if the extension is present,
+the X server is Xwayland. Clients should not need the protocol detailed in this
+document, a QueryExtension or ListExtensions request is sufficient to check
+whether the extension is present.
+
+The protocol detailed in this document is merely to future-proof this extension
+in case actual functionality is added in the future.
+
+ ❄ ❄ ❄ ❄ ❄ ❄ ❄
+2. Version History
+
+- 1.0, July 2022: QueryVersion request only
+
+ ❄ ❄ ❄ ❄ ❄ ❄ ❄
+
+3. Events and Errors
+
+XWAYLAND defines no events or errrors
+
+ ❄ ❄ ❄ ❄ ❄ ❄ ❄
+
+4. Extension initialization
+
+The name of this extension is "XWAYLAND"
+
+┌───
+ XwlQueryVersion
+ client-major-version: CARD16
+ client-minor-version: CARD16
+ ▶
+ major-version: CARD16
+ minor-version: CARD16
+└───
+
+ The client sends the highest supported version to the server
+ and the server replies with the highest version it supports,
+ but no higher than the requested version. Major versions changes
+ can introduce incompatibilities in existing functionality, minor
+ version changes introduce only backward compatible changes.
+ It is the clients responsibility to ensure that the server
+ supports a version which is compatible with its expectations.
+
+ Backwards compatible changes include addition of new
+ requests.
+
+ ❄ ❄ ❄ ❄ ❄ ❄ ❄
+
+Appendix A. Protocol Encoding
+
+Syntactic Conventions
+
+This document uses the same syntactic conventions as the core X
+protocol encoding document.
+
+A.1 Common Types
+
+None.
+
+A.2 Protocol Requests
+
+┌───
+ XwlQueryVersion
+ 1 CARD8 major opcode
+ 1 0 XWAYLAND opcode
+ 2 2 length
+ 2 CARD16 major version
+ 2 CARD16 minor version
+ ▶
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 2 CARD16 major version
+ 2 CARD16 minor version
+ 20 unused
+└───
+
+A.3 Protocol Events
+
+The XWAYLAND extension defines no events.
+
+A.4 Protocol Errors
+
+The XWAYLAND extension defines no errors.
+
+ ❄ ❄ ❄ ❄ ❄ ❄ ❄