Client: Improve support of zxdg_output_v1 version 3

by applying recommendations regarding the deprecated events

Change-Id: Ic462b1be83a1241f01f3fc909fa803615781ed2e
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Konstantin Ritt 2025-03-31 01:17:06 +03:00
parent 0544249ea7
commit f5a940a34f
2 changed files with 32 additions and 18 deletions

View File

@ -35,12 +35,12 @@
Typically, the global compositor space on a desktop system is made of Typically, the global compositor space on a desktop system is made of
a contiguous or overlapping set of rectangular regions. a contiguous or overlapping set of rectangular regions.
Some of the information provided in this protocol might be identical The logical_position and logical_size events defined in this protocol
to their counterparts already available from wl_output, in which case might provide information identical to their counterparts already
the information provided by this protocol should be preferred to their available from wl_output, in which case the information provided by this
equivalent in wl_output. The goal is to move the desktop specific protocol should be preferred to their equivalent in wl_output. The goal is
concepts (such as output location within the global compositor space, to move the desktop specific concepts (such as output location within the
the connector name and types, etc.) out of the core wl_output protocol. global compositor space, etc.) out of the core wl_output protocol.
Warning! The protocol described in this file is experimental and Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible backward incompatible changes may be made. Backward compatible
@ -117,10 +117,6 @@
The logical_size event describes the size of the output in the The logical_size event describes the size of the output in the
global compositor space. global compositor space.
For example, a surface without any buffer scale, transformation
nor rotation set, with the size matching the logical_size will
have the same size as the corresponding output when displayed.
Most regular Wayland clients should not pay attention to the Most regular Wayland clients should not pay attention to the
logical size and would rather rely on xdg_shell interfaces. logical size and would rather rely on xdg_shell interfaces.
@ -131,14 +127,14 @@
For example, for a wl_output mode 3840×2160 and a scale factor 2: For example, for a wl_output mode 3840×2160 and a scale factor 2:
- A compositor not scaling the surface buffers will advertise a - A compositor not scaling the monitor viewport in its compositing space
logical size of 3840×2160, will advertise a logical size of 3840×2160,
- A compositor automatically scaling the surface buffers will - A compositor scaling the monitor viewport with scale factor 2 will
advertise a logical size of 1920×1080, advertise a logical size of 1920×1080,
- A compositor using a fractional scale of 1.5 will advertise a - A compositor scaling the monitor viewport using a fractional scale of
logical size to 2560×1620. 1.5 will advertise a logical size of 2560×1440.
For example, for a wl_output mode 1920×1080 and a 90 degree rotation, For example, for a wl_output mode 1920×1080 and a 90 degree rotation,
the compositor will advertise a logical size of 1080x1920. the compositor will advertise a logical size of 1080x1920.
@ -155,7 +151,7 @@
summary="height in global compositor space"/> summary="height in global compositor space"/>
</event> </event>
<event name="done"> <event name="done" deprecated-since="3">
<description summary="all information about the output have been sent"> <description summary="all information about the output have been sent">
This event is sent after all other properties of an xdg_output This event is sent after all other properties of an xdg_output
have been sent. have been sent.
@ -191,6 +187,9 @@
xdg_output_manager.get_xdg_output). This event is only sent once per xdg_output_manager.get_xdg_output). This event is only sent once per
xdg_output, and the name does not change over the lifetime of the xdg_output, and the name does not change over the lifetime of the
wl_output global. wl_output global.
This event is deprecated, instead clients should use wl_output.name.
Compositors must still support this event.
</description> </description>
<arg name="name" type="string" summary="output name"/> <arg name="name" type="string" summary="output name"/>
</event> </event>
@ -212,6 +211,9 @@
For objects of version 2 and lower, this event is only sent once per For objects of version 2 and lower, this event is only sent once per
xdg_output, and the description does not change over the lifetime of xdg_output, and the description does not change over the lifetime of
the wl_output global. the wl_output global.
This event is deprecated, instead clients should use
wl_output.description. Compositors must still support this event.
</description> </description>
<arg name="description" type="string" summary="output description"/> <arg name="description" type="string" summary="output description"/>
</event> </event>

View File

@ -60,9 +60,10 @@ uint QWaylandScreen::requiredEvents() const
uint ret = OutputDoneEvent; uint ret = OutputDoneEvent;
if (mWaylandDisplay->xdgOutputManager()) { if (mWaylandDisplay->xdgOutputManager()) {
if (mWaylandDisplay->xdgOutputManager()->version() >= 2) if (mWaylandDisplay->xdgOutputManager()->version() >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION)
ret |= XdgOutputNameEvent; ret |= XdgOutputNameEvent;
// For objects version 3 onwards, zxdg_output_v1.done is deprecated.
if (mWaylandDisplay->xdgOutputManager()->version() < 3) if (mWaylandDisplay->xdgOutputManager()->version() < 3)
ret |= XdgOutputDoneEvent; ret |= XdgOutputDoneEvent;
} }
@ -387,12 +388,23 @@ void QWaylandScreen::zxdg_output_v1_name(const QString &name)
if (Q_UNLIKELY(mInitialized)) if (Q_UNLIKELY(mInitialized))
qCWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor"; qCWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor";
if (Q_UNLIKELY(mProcessedEvents & XdgOutputNameEvent)) {
qCWarning(lcQpaWayland) << "zxdg_output_v1.name received more than once, this is most likely a bug in the compositor";
return;
}
// This event is deprecated, instead clients should use wl_output.name.
if (!(mProcessedEvents & OutputNameEvent)) {
if (!name.isEmpty())
mOutputName = name; mOutputName = name;
}
mProcessedEvents |= XdgOutputNameEvent; mProcessedEvents |= XdgOutputNameEvent;
} }
void QWaylandScreen::updateXdgOutputProperties() void QWaylandScreen::updateXdgOutputProperties()
{ {
Q_ASSERT(mInitialized);
Q_ASSERT(zxdg_output_v1::isInitialized()); Q_ASSERT(zxdg_output_v1::isInitialized());
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry());
} }