[RFC PATCH wayland-protocols] Introduce logical output protocol for Xwayland

Olivier Fourdan ofourdan at redhat.com
Thu Jun 29 14:44:34 UTC 2017


This introduces a new protocol for the compositor to describe outputs
size in a logical way for Xwayland.

This is needed for X11 applications that would want to configure an X11
window based on the size of the output, without knowing the output scale
factor applied by the compositor to the corresponding Xwayland surface.

https://bugs.freedesktop.org/show_bug.cgi?id=101436

Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 Note: This is what Jonas called "wp_xwayland_configure_screen"
 in https://bugs.freedesktop.org/show_bug.cgi?id=101436#c5

 Makefile.am                                        |   1 +
 unstable/xwayland-logical-output/README            |   5 +
 .../xwayland-logical-output-unstable-v1.xml        | 101 +++++++++++++++++++++
 3 files changed, 107 insertions(+)
 create mode 100644 unstable/xwayland-logical-output/README
 create mode 100644 unstable/xwayland-logical-output/xwayland-logical-output-unstable-v1.xml

diff --git a/Makefile.am b/Makefile.am
index e693afa..e198362 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,7 @@ unstable_protocols =								\
 	unstable/tablet/tablet-unstable-v2.xml			                \
 	unstable/xdg-foreign/xdg-foreign-unstable-v1.xml			\
 	unstable/idle-inhibit/idle-inhibit-unstable-v1.xml			\
+	unstable/xwayland-logical-output/xwayland-logical-output-unstable-v1.xml	\
 	$(NULL)
 
 stable_protocols =								\
diff --git a/unstable/xwayland-logical-output/README b/unstable/xwayland-logical-output/README
new file mode 100644
index 0000000..efcaf69
--- /dev/null
+++ b/unstable/xwayland-logical-output/README
@@ -0,0 +1,5 @@
+Xwayland logical output protocol
+
+Maintainers:
+Olivier Fourdan <ofourdan at redhat.com>
+
diff --git a/unstable/xwayland-logical-output/xwayland-logical-output-unstable-v1.xml b/unstable/xwayland-logical-output/xwayland-logical-output-unstable-v1.xml
new file mode 100644
index 0000000..2b1d537
--- /dev/null
+++ b/unstable/xwayland-logical-output/xwayland-logical-output-unstable-v1.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xwayland_logical_output_unstable_v1">
+
+  <copyright>
+    Copyright © 2017 Red Hat Inc.
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <description summary="Protocol to describe logical output setup for Xwayland">
+    This optional protocol is application-specific to describe the logical
+    output setup for Xwayland. It provides a way for the compositor to
+    provide Xwayland with a specific pre-computed scaled size of the outputs.
+
+    The core Wayland interface wl_output lists all outputs and their
+    modes in hardware units along with the output scaling properties,
+    but Xwayland surfaces may be treated differently from regular Wayland
+    surfaces by the compositor, making it impossible for Xwayland to
+    reliably and consistently report all outputs to X11 clients via either
+    Xrandr or Xvidmode protocols based solely on the wl_output properties.
+
+    For example, for a compositor who does not scale Xwayland surfaces,
+    the reported output mode can match the hardware units, since the
+    requested size by X11 clients will match the actual size on the output,
+    but for another compositor who will scale the Xwayland surfaces, the
+    reported output size should be scaled down by the output scale factor
+    so that the resulting size matches the expected requested size by the
+    X11 client.
+
+    On top of that, some compositors implementing fractional scaling may
+    chose to report a larger scale factor via wl_output scale factor and
+    then scale the surface down to achieve the expected fractional scale.
+
+    This protocol specifies a way for the compositor to describe the output
+    size to Xwayland in a way that the X11 clients can use when requesting
+    a size or position.
+
+    Compositors are not required to implement this interface which remains
+    optional, however when implementing this interface, compositors are
+    required to restrict access to this application specific protocol to
+    Xwayland alone.
+
+    Warning! The protocol described in this file is experimental and
+    backward incompatible changes may be made. Backward compatible
+    changes may be added together with the corresponding interface
+    version bump.
+    Backward incompatible changes are done by bumping the version
+    number in the protocol and interface names and resetting the
+    interface version. Once the protocol is to be declared stable,
+    the 'z' prefix and the version number in the protocol and
+    interface names are removed and the interface version number is
+    reset.
+  </description>
+
+  <interface name="zwp_xwayland_logical_output" version="1">
+    <description summary="Compositor logical output region">
+      A zwp_xwayland_logical_output describes part of the output geometry
+      as exposed to X11 clients by Xwayland.
+
+      This typically corresponds to a monitor that displays part of the
+      compositor space in scaled units.
+
+      This object is published during start up, when a monitor is hot 
+      plugged or when the logical (scaled) size of the output is changed.
+    </description>
+
+    <event name="geometry">
+      <description summary="Logical geometry of the output">
+	The geometry event describes the logical size of a wl_output.
+
+	This event is sent when binding to the xwl_logical_output object
+	and whenever the logical size changes.
+      </description>
+      <arg name="output" type="object" interface="wl_output"
+           summary="corresponding wl_output"/>
+      <arg name="width" type="int"
+           summary="width of the mode in logical (scaled) units"/>
+      <arg name="height" type="int"
+           summary="height of the mode in logical (scaled) units"/>
+    </event>
+  </interface>
+
+</protocol>
+
-- 
2.9.4



More information about the xorg-devel mailing list