[PATCH nixpkgs v2 6/8] chromiumOSPackages.sommelier: update patches

Alyssa Ross
2021-05-29T14:45:01Z

Support for stable xdg-shell was implemented in upstream Sommelier,
but then reverted because the GTK version that comes with the Debian
in the container Chromium OS uses was too old to support it.

That's not a problem for us, of course, but it does mean that we can
use an upstream implementation of xdg-shell. So here I switch from
using Puck's implementation, to reverting the revert of the upstream
one.

Co-authored-by: Jamie McClymont <jamie@kwiius.com>
Cc: Puck Meerburg <puck@puckipedia.com>
---
...er-don-t-leak-source-absolute-paths.patch} | 10 +-
...tools-sommelier-Switch-to-the-stabl.patch} | 981 ++++++++++--------
...mmelier-make-building-demos-optional.patch | 100 --
.../linux/chromium-os/sommelier/default.nix | 5 +-
4 files changed, 542 insertions(+), 554 deletions(-)
rename pkgs/os-specific/linux/chromium-os/sommelier/{0004-sommelier-don-t-leak-source-absolute-paths.patch => 0003-sommelier-don-t-leak-source-absolute-paths.patch} (69%)
rename pkgs/os-specific/linux/chromium-os/sommelier/{0005-sommelier-use-stable-xdg-shell-protocol.patch => 0004-Revert-Revert-vm_tools-sommelier-Switch-to-the-stabl.patch} (66%)
delete mode 100644 pkgs/os-specific/linux/chromium-os/sommelier/0006-sommelier-make-building-demos-optional.patch

diff --git a/pkgs/os-specific/linux/chromium-os/sommelier/0004-sommelier-don-t-leak-source-absolute-paths.patch b/pkgs/os-specific/linux/chromium-os/sommelier/0003-sommelier-don-t-leak-source-absolute-paths.patch
similarity index 69%
rename from pkgs/os-specific/linux/chromium-os/sommelier/0004-sommelier-don-t-leak-source-absolute-paths.patch
rename to pkgs/os-specific/linux/chromium-os/sommelier/0003-sommelier-don-t-leak-source-absolute-paths.patch
index 309165c8a05..515daf80073 100644
--- a/pkgs/os-specific/linux/chromium-os/sommelier/0004-sommelier-don-t-leak-source-absolute-paths.patch
+++ b/pkgs/os-specific/linux/chromium-os/sommelier/0003-sommelier-don-t-leak-source-absolute-paths.patch
@@ -1,17 +1,17 @@
-From 7fd2b67e7b265f7c2014ce7183c483f34e1a8ec9 Mon Sep 17 00:00:00 2001
+From 98cff9d9c6cd0642ecb54f0fbb799a6a9c666035 Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Sun, 1 Dec 2019 17:04:04 +0000
-Subject: [PATCH 4/6] sommelier: don't leak source-absolute paths
+Subject: [PATCH 3/4] sommelier: don't leak source-absolute paths

---
vm_tools/sommelier/wayland_protocol.gni | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vm_tools/sommelier/wayland_protocol.gni b/vm_tools/sommelier/wayland_protocol.gni
-index 4f18a0c10..b1bd5d659 100644
+index f894adf81d..28bb5a006b 100644
--- a/vm_tools/sommelier/wayland_protocol.gni
+++ b/vm_tools/sommelier/wayland_protocol.gni
-@@ -44,7 +44,7 @@ template("wayland_protocol_library") {
+@@ -42,7 +42,7 @@ template("wayland_protocol_library") {
"wayland-scanner",
g.subcommand,
"{{source}}",
@@ -21,5 +21,5 @@ index 4f18a0c10..b1bd5d659 100644
}
}
--
-2.26.2
+2.30.0

diff --git a/pkgs/os-specific/linux/chromium-os/sommelier/0005-sommelier-use-stable-xdg-shell-protocol.patch b/pkgs/os-specific/linux/chromium-os/sommelier/0004-Revert-Revert-vm_tools-sommelier-Switch-to-the-stabl.patch
similarity index 66%
rename from pkgs/os-specific/linux/chromium-os/sommelier/0005-sommelier-use-stable-xdg-shell-protocol.patch
rename to pkgs/os-specific/linux/chromium-os/sommelier/0004-Revert-Revert-vm_tools-sommelier-Switch-to-the-stabl.patch
index 41a42df74fd..fcc8a5d8ad7 100644
--- a/pkgs/os-specific/linux/chromium-os/sommelier/0005-sommelier-use-stable-xdg-shell-protocol.patch
+++ b/pkgs/os-specific/linux/chromium-os/sommelier/0004-Revert-Revert-vm_tools-sommelier-Switch-to-the-stabl.patch
@@ -1,28 +1,25 @@
-From d3a8f6b49e35744e71271cab1eb9ea9a5c87854d Mon Sep 17 00:00:00 2001
-From: Puck Meerburg <puck@puckipedia.com>
-Date: Tue, 3 Dec 2019 18:06:14 +0000
-Subject: [PATCH 5/6] sommelier: use stable xdg-shell protocol
+From 1ff39f1a4e5ac194a1e3ca52632342794eedc130 Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Fri, 2 Apr 2021 17:55:55 +0000
+Subject: [PATCH 4/4] Revert "Revert "vm_tools: sommelier: Switch to the stable
+ version of xdg-shell""

-From https://github.com/wayland-project/weston/commit/d8d9f5e6e16c8f6a3c06763d5f56c27dc9a6e52e:
-
-> Some clients like the mpv video player now request the xdg_shell
-> protocol so these will fail if the compositor only provides the
-> xdg_shell_unstable_v6 protocol. Compositors like mir and gnome provide
-> both protocols.
+This reverts commit 32050c0ea6c00c16999915856b40a6a6b8b41bb9.
---
vm_tools/sommelier/BUILD.gn | 2 +-
- ...dg-shell-unstable-v6.xml => xdg-shell.xml} | 319 ++++++++++++------
- vm_tools/sommelier/sommelier-xdg-shell.c | 233 ++++++-------
- vm_tools/sommelier/sommelier.c | 211 ++++++------
- vm_tools/sommelier/sommelier.h | 17 +-
- 5 files changed, 447 insertions(+), 335 deletions(-)
- rename vm_tools/sommelier/protocol/{xdg-shell-unstable-v6.xml => xdg-shell.xml} (79%)
+ vm_tools/sommelier/meson.build | 2 +-
+ ...dg-shell-unstable-v6.xml => xdg-shell.xml} | 435 +++++++++++++-----
+ vm_tools/sommelier/sommelier-xdg-shell.cc | 217 +++++----
+ vm_tools/sommelier/sommelier.cc | 210 +++++----
+ vm_tools/sommelier/sommelier.h | 8 +-
+ 6 files changed, 535 insertions(+), 339 deletions(-)
+ rename vm_tools/sommelier/protocol/{xdg-shell-unstable-v6.xml => xdg-shell.xml} (71%)

diff --git a/vm_tools/sommelier/BUILD.gn b/vm_tools/sommelier/BUILD.gn
-index 5027628d2..4330560a1 100644
+index fe8481bee1..7fdebbb201 100644
--- a/vm_tools/sommelier/BUILD.gn
+++ b/vm_tools/sommelier/BUILD.gn
-@@ -68,7 +68,7 @@ wayland_protocol_library("sommelier-protocol") {
+@@ -64,7 +64,7 @@ wayland_protocol_library("sommelier-protocol") {
"protocol/relative-pointer-unstable-v1.xml",
"protocol/text-input-unstable-v1.xml",
"protocol/viewporter.xml",
@@ -31,11 +28,24 @@ index 5027628d2..4330560a1 100644
]
}

+diff --git a/vm_tools/sommelier/meson.build b/vm_tools/sommelier/meson.build
+index cd33ec8fec..9eb8a2fb30 100644
+--- a/vm_tools/sommelier/meson.build
++++ b/vm_tools/sommelier/meson.build
+@@ -58,7 +58,7 @@ wl_protocols = [
+ 'protocol/relative-pointer-unstable-v1.xml',
+ 'protocol/text-input-unstable-v1.xml',
+ 'protocol/viewporter.xml',
+- 'protocol/xdg-shell-unstable-v6.xml',
++ 'protocol/xdg-shell.xml',
+ ]
+
+ wl_outs = []
diff --git a/vm_tools/sommelier/protocol/xdg-shell-unstable-v6.xml b/vm_tools/sommelier/protocol/xdg-shell.xml
-similarity index 79%
+similarity index 71%
rename from vm_tools/sommelier/protocol/xdg-shell-unstable-v6.xml
rename to vm_tools/sommelier/protocol/xdg-shell.xml
-index 1c0f92452..3a87a9ed6 100644
+index 1c0f92452b..f7377a713c 100644
--- a/vm_tools/sommelier/protocol/xdg-shell-unstable-v6.xml
+++ b/vm_tools/sommelier/protocol/xdg-shell.xml
@@ -1,11 +1,13 @@
@@ -58,7 +68,7 @@ index 1c0f92452..3a87a9ed6 100644
</copyright>

- <interface name="zxdg_shell_v6" version="1">
-+ <interface name="xdg_wm_base" version="2">
++ <interface name="xdg_wm_base" version="3">
<description summary="create desktop-style surfaces">
- xdg_shell allows clients to turn a wl_surface into a "real window"
- which can be dragged, resized, stacked, and moved around by the
@@ -142,7 +152,7 @@ index 1c0f92452..3a87a9ed6 100644
</interface>

- <interface name="zxdg_positioner_v6" version="1">
-+ <interface name="xdg_positioner" version="2">
++ <interface name="xdg_positioner" version="3">
<description summary="child surface positioner">
The xdg_positioner provides a collection of rules for the placement of a
child surface relative to a parent surface. Rules can be defined to ensure
@@ -280,16 +290,58 @@ index 1c0f92452..3a87a9ed6 100644
If the adjusted position also ends up being constrained, the resulting
position of the flip_y adjustment will be the one before the
adjustment.
-@@ -361,7 +359,7 @@
+@@ -359,9 +357,49 @@
+ <arg name="x" type="int" summary="surface position x offset"/>
+ <arg name="y" type="int" summary="surface position y offset"/>
</request>
++
++
++
++ <request name="set_reactive" since="3">
++ <description summary="continuously reconstrain the surface">
++ When set reactive, the surface is reconstrained if the conditions used
++ for constraining changed, e.g. the parent window moved.
++
++ If the conditions changed and the popup was reconstrained, an
++ xdg_popup.configure event is sent with updated geometry, followed by an
++ xdg_surface.configure event.
++ </description>
++ </request>
++
++ <request name="set_parent_size" since="3">
++ <description summary="">
++ Set the parent window geometry the compositor should use when
++ positioning the popup. The compositor may use this information to
++ determine the future state the popup should be constrained using. If
++ this doesn't match the dimension of the parent the popup is eventually
++ positioned against, the behavior is undefined.
++
++ The arguments are given in the surface-local coordinate space.
++ </description>
++ <arg name="parent_width" type="int"
++ summary="future window geometry width of parent"/>
++ <arg name="parent_height" type="int"
++ summary="future window geometry height of parent"/>
++ </request>
++
++ <request name="set_parent_configure" since="3">
++ <description summary="set parent configure this is a response to">
++ Set the serial of a xdg_surface.configure event this positioner will be
++ used in response to. The compositor may use this information together
++ with set_parent_size to determine what future state the popup should be
++ constrained using.
++ </description>
++ <arg name="serial" type="uint"
++ summary="serial of parent configure event"/>
++ </request>
</interface>

- <interface name="zxdg_surface_v6" version="1">
-+ <interface name="xdg_surface" version="2">
++ <interface name="xdg_surface" version="3">
<description summary="desktop user interface surface base interface">
An interface that may be implemented by a wl_surface, for
implementations that provide a desktop-style user interface.
-@@ -388,11 +386,20 @@
+@@ -388,11 +426,25 @@
manipulate a buffer prior to the first xdg_surface.configure call must
also be treated as errors.

@@ -298,6 +350,11 @@ index 1c0f92452..3a87a9ed6 100644
- surface, (2) the client has set and committed the xdg_surface state and
- the role dependent state to the surface and (3) the client has committed a
- buffer to the surface.
++ After creating a role-specific object and setting it up, the client must
++ perform an initial commit without any buffer attached. The compositor
++ will reply with an xdg_surface.configure event. The client must
++ acknowledge it and is then allowed to attach a buffer to map the surface.
++
+ Mapping an xdg_surface-based role surface is defined as making it
+ possible for the surface to be shown by the compositor. Note that
+ a mapped surface is not guaranteed to be visible once it is mapped.
@@ -315,7 +372,7 @@ index 1c0f92452..3a87a9ed6 100644
</description>

<enum name="error">
-@@ -416,20 +423,23 @@
+@@ -416,20 +468,23 @@
See the documentation of xdg_toplevel for more details about what an
xdg_toplevel is and how it is used.
</description>
@@ -345,7 +402,7 @@ index 1c0f92452..3a87a9ed6 100644
</request>

<request name="set_window_geometry">
-@@ -442,6 +452,11 @@
+@@ -442,6 +497,11 @@
The window geometry is double buffered, and will be applied at the
time wl_surface.commit of the corresponding wl_surface is called.

@@ -357,12 +414,15 @@ index 1c0f92452..3a87a9ed6 100644
Once the window geometry of the surface is set, it is not possible to
unset it, and it will remain the same until set_window_geometry is
called again, even if a new subsurface or buffer is attached.
-@@ -513,34 +528,50 @@
+@@ -511,36 +571,57 @@
+ </description>
+ <arg name="serial" type="uint" summary="serial of the configure event"/>
</event>
++
</interface>

- <interface name="zxdg_toplevel_v6" version="1">
-+ <interface name="xdg_toplevel" version="2">
++ <interface name="xdg_toplevel" version="3">
<description summary="toplevel surface">
This interface defines an xdg_surface role which allows a surface to,
among other things, set window-like properties such as maximize,
@@ -374,7 +434,11 @@ index 1c0f92452..3a87a9ed6 100644
+ by the compositor until it is explicitly mapped again.
+ All active operations (e.g., move, resize) are canceled and all
+ attributes (e.g. title, state, stacking, ...) are discarded for
-+ an xdg_toplevel surface when it is unmapped.
++ an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
++ the state it had right after xdg_surface.get_toplevel. The client
++ can re-map the toplevel by perfoming a commit without any buffer
++ attached, waiting for a configure event and handling it as usual (see
++ xdg_surface description).
+
+ Attaching a null buffer to a toplevel unmaps the surface.
</description>
@@ -416,7 +480,7 @@ index 1c0f92452..3a87a9ed6 100644
</request>

<request name="set_title">
-@@ -573,6 +604,9 @@
+@@ -573,6 +654,9 @@
For example, "org.freedesktop.FooViewer" where the .desktop file is
"org.freedesktop.FooViewer.desktop".

@@ -426,7 +490,16 @@ index 1c0f92452..3a87a9ed6 100644
See the desktop-entry specification [0] for more details on
application identifiers and how they relate to well-known D-Bus
names and .desktop files.
-@@ -693,12 +727,18 @@
+@@ -676,7 +760,7 @@
+ </description>
+ <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
+ <arg name="serial" type="uint" summary="the serial of the user event"/>
+- <arg name="edges" type="uint" summary="which edge or corner is being dragged"/>
++ <arg name="edges" type="uint" enum="resize_edge" summary="which edge or corner is being dragged"/>
+ </request>
+
+ <enum name="state">
+@@ -693,12 +777,18 @@
<description summary="the surface is maximized">
The surface is maximized. The window geometry specified in the configure
event must be obeyed by the client.
@@ -447,7 +520,7 @@ index 1c0f92452..3a87a9ed6 100644
</description>
</entry>
<entry name="resizing" value="3" summary="the surface is being resized">
-@@ -716,6 +756,30 @@
+@@ -716,6 +806,30 @@
keyboard or pointer focus.
</description>
</entry>
@@ -478,7 +551,7 @@ index 1c0f92452..3a87a9ed6 100644
</enum>

<request name="set_max_size">
-@@ -805,12 +869,11 @@
+@@ -805,12 +919,11 @@
Maximize the surface.

After requesting that the surface should be maximized, the compositor
@@ -496,7 +569,7 @@ index 1c0f92452..3a87a9ed6 100644

It is up to the compositor to decide how and where to maximize the
surface, for example which output and what region of the screen should
-@@ -818,6 +881,10 @@
+@@ -818,6 +931,10 @@

If the surface was already maximized, the compositor will still emit
a configure event with the "maximized" state.
@@ -507,7 +580,7 @@ index 1c0f92452..3a87a9ed6 100644
</description>
</request>

-@@ -826,13 +893,13 @@
+@@ -826,13 +943,13 @@
Unmaximize the surface.

After requesting that the surface should be unmaximized, the compositor
@@ -528,7 +601,7 @@ index 1c0f92452..3a87a9ed6 100644

It is up to the compositor to position the surface after it was
unmaximized; usually the position the surface had before maximizing, if
-@@ -840,24 +907,63 @@
+@@ -840,24 +957,63 @@

If the surface was already not maximized, the compositor will still
emit a configure event without the "maximized" state.
@@ -598,16 +671,16 @@ index 1c0f92452..3a87a9ed6 100644

<request name="set_minimized">
<description summary="set the window as minimized">
-@@ -913,7 +1019,7 @@
+@@ -913,7 +1069,7 @@
</event>
</interface>

- <interface name="zxdg_popup_v6" version="1">
-+ <interface name="xdg_popup" version="2">
++ <interface name="xdg_popup" version="3">
<description summary="short-lived, popup surfaces for menus">
A popup surface is a short-lived, temporary surface. It can be used to
implement for example menus, popovers, tooltips and other similar user
-@@ -931,9 +1037,6 @@
+@@ -931,21 +1087,12 @@
surface of their own is clicked should dismiss the popup using the destroy
request.

@@ -617,21 +690,103 @@ index 1c0f92452..3a87a9ed6 100644
A newly created xdg_popup will be stacked on top of all previously created
xdg_popup surfaces associated with the same xdg_toplevel.

-diff --git a/vm_tools/sommelier/sommelier-xdg-shell.c b/vm_tools/sommelier/sommelier-xdg-shell.c
-index ecd0fc647..a3ba0d6e1 100644
---- a/vm_tools/sommelier/sommelier-xdg-shell.c
-+++ b/vm_tools/sommelier/sommelier-xdg-shell.c
+ The parent of an xdg_popup must be mapped (see the xdg_surface
+ description) before the xdg_popup itself.
+
+- The x and y arguments passed when creating the popup object specify
+- where the top left of the popup should be placed, relative to the
+- local surface coordinates of the parent surface. See
+- xdg_surface.get_popup. An xdg_popup must intersect with or be at least
+- partially adjacent to its parent surface.
+-
+ The client must call wl_surface.commit on the corresponding wl_surface
+ for the xdg_popup state to take effect.
+ </description>
+@@ -1023,6 +1170,11 @@
+ The x and y arguments represent the position the popup was placed at
+ given the xdg_positioner rule, relative to the upper left corner of the
+ window geometry of the parent surface.
++
++ For version 2 or older, the configure event for an xdg_popup is only
++ ever sent once for the initial configuration. Starting with version 3,
++ it may be sent again if the popup is setup with an xdg_positioner with
++ set_reactive requested, or in response to xdg_popup.reposition requests.
+ </description>
+ <arg name="x" type="int"
+ summary="x position relative to parent surface window geometry"/>
+@@ -1040,5 +1192,58 @@
+ </description>
+ </event>
+
++
++
++ <request name="reposition" since="3">
++ <description summary="recalculate the popup's location">
++ Reposition an already-mapped popup. The popup will be placed given the
++ details in the passed xdg_positioner object, and a
++ xdg_popup.repositioned followed by xdg_popup.configure and
++ xdg_surface.configure will be emitted in response. Any parameters set
++ by the previous positioner will be discarded.
++
++ The passed token will be sent in the corresponding
++ xdg_popup.repositioned event. The new popup position will not take
++ effect until the corresponding configure event is acknowledged by the
++ client. See xdg_popup.repositioned for details. The token itself is
++ opaque, and has no other special meaning.
++
++ If multiple reposition requests are sent, the compositor may skip all
++ but the last one.
++
++ If the popup is repositioned in response to a configure event for its
++ parent, the client should send an xdg_positioner.set_parent_configure
++ and possibly a xdg_positioner.set_parent_size request to allow the
++ compositor to properly constrain the popup.
++
++ If the popup is repositioned together with a parent that is being
++ resized, but not in response to a configure event, the client should
++ send a xdg_positioner.set_parent_size request.
++ </description>
++ <arg name="positioner" type="object" interface="xdg_positioner"/>
++ <arg name="token" type="uint" summary="reposition request token"/>
++ </request>
++
++ <event name="repositioned" since="3">
++ <description summary="signal the completion of a repositioned request">
++ The repositioned event is sent as part of a popup configuration
++ sequence, together with xdg_popup.configure and lastly
++ xdg_surface.configure to notify the completion of a reposition request.
++
++ The repositioned event is to notify about the completion of a
++ xdg_popup.reposition request. The token argument is the token passed
++ in the xdg_popup.reposition request.
++
++ Immediately after this event is emitted, xdg_popup.configure and
++ xdg_surface.configure will be sent with the updated size and position,
++ as well as a new configure serial.
++
++ The client should optionally update the content of the popup, but must
++ acknowledge the new popup configuration for the new position to take
++ effect. See xdg_surface.ack_configure for details.
++ </description>
++ <arg name="token" type="uint" summary="reposition request token"/>
++ </event>
++
+ </interface>
+ </protocol>
+diff --git a/vm_tools/sommelier/sommelier-xdg-shell.cc b/vm_tools/sommelier/sommelier-xdg-shell.cc
+index 91744a67e3..45b8eeb93e 100644
+--- a/vm_tools/sommelier/sommelier-xdg-shell.cc
++++ b/vm_tools/sommelier/sommelier-xdg-shell.cc
@@ -7,37 +7,37 @@
#include <assert.h>
#include <stdlib.h>

--#include "xdg-shell-unstable-v6-client-protocol.h"
--#include "xdg-shell-unstable-v6-server-protocol.h"
-+#include "xdg-shell-client-protocol.h"
-+#include "xdg-shell-server-protocol.h"
+-#include "xdg-shell-unstable-v6-client-protocol.h" // NOLINT(build/include_directory)
+-#include "xdg-shell-unstable-v6-server-protocol.h" // NOLINT(build/include_directory)
++#include "xdg-shell-client-protocol.h" // NOLINT(build/include_directory)
++#include "xdg-shell-server-protocol.h" // NOLINT(build/include_directory)

--struct sl_host_xdg_shell {
-+struct sl_host_xdg_wm_base {
+ struct sl_host_xdg_shell {
struct sl_context* ctx;
struct wl_resource* resource;
- struct zxdg_shell_v6* proxy;
@@ -667,8 +822,8 @@ index ecd0fc647..a3ba0d6e1 100644
};

static void sl_xdg_positioner_destroy(struct wl_client* client,
-@@ -52,7 +52,7 @@ static void sl_xdg_positioner_set_size(struct wl_client* client,
- struct sl_host_xdg_positioner* host = wl_resource_get_user_data(resource);
+@@ -53,7 +53,7 @@ static void sl_xdg_positioner_set_size(struct wl_client* client,
+ static_cast<sl_host_xdg_positioner*>(wl_resource_get_user_data(resource));
double scale = host->ctx->scale;

- zxdg_positioner_v6_set_size(host->proxy, width / scale, height / scale);
@@ -676,7 +831,7 @@ index ecd0fc647..a3ba0d6e1 100644
}

static void sl_xdg_positioner_set_anchor_rect(struct wl_client* client,
-@@ -70,7 +70,7 @@ static void sl_xdg_positioner_set_anchor_rect(struct wl_client* client,
+@@ -72,7 +72,7 @@ static void sl_xdg_positioner_set_anchor_rect(struct wl_client* client,
x2 = (x + width) / scale;
y2 = (y + height) / scale;

@@ -685,37 +840,36 @@ index ecd0fc647..a3ba0d6e1 100644
}

static void sl_xdg_positioner_set_anchor(struct wl_client* client,
-@@ -78,7 +78,7 @@ static void sl_xdg_positioner_set_anchor(struct wl_client* client,
- uint32_t anchor) {
- struct sl_host_xdg_positioner* host = wl_resource_get_user_data(resource);
+@@ -81,7 +81,7 @@ static void sl_xdg_positioner_set_anchor(struct wl_client* client,
+ struct sl_host_xdg_positioner* host =
+ static_cast<sl_host_xdg_positioner*>(wl_resource_get_user_data(resource));

- zxdg_positioner_v6_set_anchor(host->proxy, anchor);
+ xdg_positioner_set_anchor(host->proxy, anchor);
}

static void sl_xdg_positioner_set_gravity(struct wl_client* client,
-@@ -86,7 +86,7 @@ static void sl_xdg_positioner_set_gravity(struct wl_client* client,
- uint32_t gravity) {
- struct sl_host_xdg_positioner* host = wl_resource_get_user_data(resource);
+@@ -90,7 +90,7 @@ static void sl_xdg_positioner_set_gravity(struct wl_client* client,
+ struct sl_host_xdg_positioner* host =
+ static_cast<sl_host_xdg_positioner*>(wl_resource_get_user_data(resource));

- zxdg_positioner_v6_set_gravity(host->proxy, gravity);
+ xdg_positioner_set_gravity(host->proxy, gravity);
}

static void sl_xdg_positioner_set_constraint_adjustment(
-@@ -95,8 +95,8 @@ static void sl_xdg_positioner_set_constraint_adjustment(
- uint32_t constraint_adjustment) {
- struct sl_host_xdg_positioner* host = wl_resource_get_user_data(resource);
+@@ -100,8 +100,7 @@ static void sl_xdg_positioner_set_constraint_adjustment(
+ struct sl_host_xdg_positioner* host =
+ static_cast<sl_host_xdg_positioner*>(wl_resource_get_user_data(resource));

- zxdg_positioner_v6_set_constraint_adjustment(host->proxy,
- constraint_adjustment);
-+ xdg_positioner_set_constraint_adjustment(host->proxy,
-+ constraint_adjustment);
- }
++ xdg_positioner_set_constraint_adjustment(host->proxy, constraint_adjustment);
+ } // NOLINT(whitespace/indent)

static void sl_xdg_positioner_set_offset(struct wl_client* client,
-@@ -106,10 +106,10 @@ static void sl_xdg_positioner_set_offset(struct wl_client* client,
- struct sl_host_xdg_positioner* host = wl_resource_get_user_data(resource);
+@@ -112,24 +111,23 @@ static void sl_xdg_positioner_set_offset(struct wl_client* client,
+ static_cast<sl_host_xdg_positioner*>(wl_resource_get_user_data(resource));
double scale = host->ctx->scale;

- zxdg_positioner_v6_set_offset(host->proxy, x / scale, y / scale);
@@ -723,26 +877,39 @@ index ecd0fc647..a3ba0d6e1 100644
}

-static const struct zxdg_positioner_v6_interface
-+static const struct xdg_positioner_interface
- sl_xdg_positioner_implementation = {
- sl_xdg_positioner_destroy,
- sl_xdg_positioner_set_size,
-@@ -122,7 +122,7 @@ static const struct zxdg_positioner_v6_interface
+- sl_xdg_positioner_implementation = {
+- sl_xdg_positioner_destroy,
+- sl_xdg_positioner_set_size,
+- sl_xdg_positioner_set_anchor_rect,
+- sl_xdg_positioner_set_anchor,
+- sl_xdg_positioner_set_gravity,
+- sl_xdg_positioner_set_constraint_adjustment,
+- sl_xdg_positioner_set_offset};
++static const struct xdg_positioner_interface sl_xdg_positioner_implementation =
++ {sl_xdg_positioner_destroy,
++ sl_xdg_positioner_set_size,
++ sl_xdg_positioner_set_anchor_rect,
++ sl_xdg_positioner_set_anchor,
++ sl_xdg_positioner_set_gravity,
++ sl_xdg_positioner_set_constraint_adjustment,
++ sl_xdg_positioner_set_offset};
+
static void sl_destroy_host_xdg_positioner(struct wl_resource* resource) {
- struct sl_host_xdg_positioner* host = wl_resource_get_user_data(resource);
+ struct sl_host_xdg_positioner* host =
+ static_cast<sl_host_xdg_positioner*>(wl_resource_get_user_data(resource));

- zxdg_positioner_v6_destroy(host->proxy);
+ xdg_positioner_destroy(host->proxy);
wl_resource_set_user_data(resource, NULL);
free(host);
}
-@@ -139,19 +139,19 @@ static void sl_xdg_popup_grab(struct wl_client* client,
- struct sl_host_xdg_popup* host = wl_resource_get_user_data(resource);
- struct sl_host_seat* host_seat = wl_resource_get_user_data(seat_resource);
+@@ -148,20 +146,20 @@ static void sl_xdg_popup_grab(struct wl_client* client,
+ struct sl_host_seat* host_seat =
+ static_cast<sl_host_seat*>(wl_resource_get_user_data(seat_resource));

- zxdg_popup_v6_grab(host->proxy, host_seat->proxy, serial);
+ xdg_popup_grab(host->proxy, host_seat->proxy, serial);
- }
+ } // NOLINT(whitespace/indent)

-static const struct zxdg_popup_v6_interface sl_xdg_popup_implementation = {
+static const struct xdg_popup_interface sl_xdg_popup_implementation = {
@@ -755,12 +922,13 @@ index ecd0fc647..a3ba0d6e1 100644
int32_t y,
int32_t width,
int32_t height) {
-- struct sl_host_xdg_popup* host = zxdg_popup_v6_get_user_data(xdg_popup);
-+ struct sl_host_xdg_popup* host = xdg_popup_get_user_data(xdg_popup);
+ struct sl_host_xdg_popup* host =
+- static_cast<sl_host_xdg_popup*>(zxdg_popup_v6_get_user_data(xdg_popup));
++ static_cast<sl_host_xdg_popup*>(xdg_popup_get_user_data(xdg_popup));
double scale = host->ctx->scale;
int32_t x1, y1, x2, y2;

-@@ -160,23 +160,23 @@ static void sl_xdg_popup_configure(void* data,
+@@ -170,25 +168,24 @@ static void sl_xdg_popup_configure(void* data,
x2 = (x + width) * scale;
y2 = (y + height) * scale;

@@ -768,11 +936,12 @@ index ecd0fc647..a3ba0d6e1 100644
+ xdg_popup_send_configure(host->resource, x1, y1, x2 - x1, y2 - y1);
}

- static void sl_xdg_popup_popup_done(void* data,
+-static void sl_xdg_popup_popup_done(void* data,
- struct zxdg_popup_v6* xdg_popup) {
-- struct sl_host_xdg_popup* host = zxdg_popup_v6_get_user_data(xdg_popup);
-+ struct xdg_popup* xdg_popup) {
-+ struct sl_host_xdg_popup* host = xdg_popup_get_user_data(xdg_popup);
++static void sl_xdg_popup_popup_done(void* data, struct xdg_popup* xdg_popup) {
+ struct sl_host_xdg_popup* host =
+- static_cast<sl_host_xdg_popup*>(zxdg_popup_v6_get_user_data(xdg_popup));
++ static_cast<sl_host_xdg_popup*>(xdg_popup_get_user_data(xdg_popup));

- zxdg_popup_v6_send_popup_done(host->resource);
+ xdg_popup_send_popup_done(host->resource);
@@ -783,140 +952,152 @@ index ecd0fc647..a3ba0d6e1 100644
sl_xdg_popup_configure, sl_xdg_popup_popup_done};

static void sl_destroy_host_xdg_popup(struct wl_resource* resource) {
- struct sl_host_xdg_popup* host = wl_resource_get_user_data(resource);
+ struct sl_host_xdg_popup* host =
+ static_cast<sl_host_xdg_popup*>(wl_resource_get_user_data(resource));

- zxdg_popup_v6_destroy(host->proxy);
+ xdg_popup_destroy(host->proxy);
wl_resource_set_user_data(resource, NULL);
free(host);
}
-@@ -193,8 +193,8 @@ static void sl_xdg_toplevel_set_parent(struct wl_client* client,
- struct sl_host_xdg_toplevel* host_parent =
- parent_resource ? wl_resource_get_user_data(parent_resource) : NULL;
+@@ -208,8 +205,7 @@ static void sl_xdg_toplevel_set_parent(struct wl_client* client,
+ wl_resource_get_user_data(parent_resource))
+ : NULL;

- zxdg_toplevel_v6_set_parent(host->proxy,
- host_parent ? host_parent->proxy : NULL);
-+ xdg_toplevel_set_parent(host->proxy,
-+ host_parent ? host_parent->proxy : NULL);
++ xdg_toplevel_set_parent(host->proxy, host_parent ? host_parent->proxy : NULL);
}

static void sl_xdg_toplevel_set_title(struct wl_client* client,
-@@ -202,7 +202,7 @@ static void sl_xdg_toplevel_set_title(struct wl_client* client,
- const char* title) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -218,7 +214,7 @@ static void sl_xdg_toplevel_set_title(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_set_title(host->proxy, title);
+ xdg_toplevel_set_title(host->proxy, title);
}

static void sl_xdg_toplevel_set_app_id(struct wl_client* client,
-@@ -210,7 +210,7 @@ static void sl_xdg_toplevel_set_app_id(struct wl_client* client,
- const char* app_id) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -227,7 +223,7 @@ static void sl_xdg_toplevel_set_app_id(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_set_app_id(host->proxy, app_id);
+ xdg_toplevel_set_app_id(host->proxy, app_id);
}

static void sl_xdg_toplevel_show_window_menu(struct wl_client* client,
-@@ -223,7 +223,7 @@ static void sl_xdg_toplevel_show_window_menu(struct wl_client* client,
- struct sl_host_seat* host_seat =
- seat_resource ? wl_resource_get_user_data(seat_resource) : NULL;
+@@ -243,7 +239,7 @@ static void sl_xdg_toplevel_show_window_menu(struct wl_client* client,
+ ? static_cast<sl_host_seat*>(wl_resource_get_user_data(seat_resource))
+ : NULL;

- zxdg_toplevel_v6_show_window_menu(
+ xdg_toplevel_show_window_menu(
host->proxy, host_seat ? host_seat->proxy : NULL, serial, x, y);
- }
+ } // NOLINT(whitespace/indent)

-@@ -235,8 +235,8 @@ static void sl_xdg_toplevel_move(struct wl_client* client,
- struct sl_host_seat* host_seat =
- seat_resource ? wl_resource_get_user_data(seat_resource) : NULL;
+@@ -258,8 +254,7 @@ static void sl_xdg_toplevel_move(struct wl_client* client,
+ ? static_cast<sl_host_seat*>(wl_resource_get_user_data(seat_resource))
+ : NULL;

- zxdg_toplevel_v6_move(host->proxy, host_seat ? host_seat->proxy : NULL,
- serial);
-+ xdg_toplevel_move(host->proxy, host_seat ? host_seat->proxy : NULL,
-+ serial);
- }
++ xdg_toplevel_move(host->proxy, host_seat ? host_seat->proxy : NULL, serial);
+ } // NOLINT(whitespace/indent)

static void sl_xdg_toplevel_resize(struct wl_client* client,
-@@ -248,8 +248,8 @@ static void sl_xdg_toplevel_resize(struct wl_client* client,
- struct sl_host_seat* host_seat =
- seat_resource ? wl_resource_get_user_data(seat_resource) : NULL;
+@@ -274,8 +269,8 @@ static void sl_xdg_toplevel_resize(struct wl_client* client,
+ ? static_cast<sl_host_seat*>(wl_resource_get_user_data(seat_resource))
+ : NULL;

- zxdg_toplevel_v6_resize(host->proxy, host_seat ? host_seat->proxy : NULL,
- serial, edges);
-+ xdg_toplevel_resize(host->proxy, host_seat ? host_seat->proxy : NULL,
-+ serial, edges);
- }
++ xdg_toplevel_resize(host->proxy, host_seat ? host_seat->proxy : NULL, serial,
++ edges);
+ } // NOLINT(whitespace/indent)

static void sl_xdg_toplevel_set_max_size(struct wl_client* client,
-@@ -258,7 +258,7 @@ static void sl_xdg_toplevel_set_max_size(struct wl_client* client,
- int32_t height) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -285,7 +280,7 @@ static void sl_xdg_toplevel_set_max_size(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_set_max_size(host->proxy, width, height);
+ xdg_toplevel_set_max_size(host->proxy, width, height);
}

static void sl_xdg_toplevel_set_min_size(struct wl_client* client,
-@@ -267,21 +267,21 @@ static void sl_xdg_toplevel_set_min_size(struct wl_client* client,
- int32_t height) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -295,7 +290,7 @@ static void sl_xdg_toplevel_set_min_size(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_set_min_size(host->proxy, width, height);
+ xdg_toplevel_set_min_size(host->proxy, width, height);
}

static void sl_xdg_toplevel_set_maximized(struct wl_client* client,
- struct wl_resource* resource) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -303,7 +298,7 @@ static void sl_xdg_toplevel_set_maximized(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_set_maximized(host->proxy);
+ xdg_toplevel_set_maximized(host->proxy);
}

static void sl_xdg_toplevel_unset_maximized(struct wl_client* client,
- struct wl_resource* resource) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -311,7 +306,7 @@ static void sl_xdg_toplevel_unset_maximized(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_unset_maximized(host->proxy);
+ xdg_toplevel_unset_maximized(host->proxy);
}

static void sl_xdg_toplevel_set_fullscreen(
-@@ -292,25 +292,25 @@ static void sl_xdg_toplevel_set_fullscreen(
- struct sl_host_output* host_output =
- output_resource ? wl_resource_get_user_data(output_resource) : NULL;
+@@ -325,8 +320,8 @@ static void sl_xdg_toplevel_set_fullscreen(
+ wl_resource_get_user_data(output_resource))
+ : NULL;

- zxdg_toplevel_v6_set_fullscreen(host->proxy,
- host_output ? host_output->proxy : NULL);
+ xdg_toplevel_set_fullscreen(host->proxy,
+ host_output ? host_output->proxy : NULL);
- }
+ } // NOLINT(whitespace/indent)

static void sl_xdg_toplevel_unset_fullscreen(struct wl_client* client,
- struct wl_resource* resource) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -334,7 +329,7 @@ static void sl_xdg_toplevel_unset_fullscreen(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_unset_fullscreen(host->proxy);
+ xdg_toplevel_unset_fullscreen(host->proxy);
}

static void sl_xdg_toplevel_set_minimized(struct wl_client* client,
- struct wl_resource* resource) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+@@ -342,47 +337,47 @@ static void sl_xdg_toplevel_set_minimized(struct wl_client* client,
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_set_minimized(host->proxy);
+ xdg_toplevel_set_minimized(host->proxy);
}

-static const struct zxdg_toplevel_v6_interface sl_xdg_toplevel_implementation =
-+static const struct xdg_toplevel_interface sl_xdg_toplevel_implementation =
- {sl_xdg_toplevel_destroy, sl_xdg_toplevel_set_parent,
- sl_xdg_toplevel_set_title, sl_xdg_toplevel_set_app_id,
- sl_xdg_toplevel_show_window_menu, sl_xdg_toplevel_move,
-@@ -320,33 +320,33 @@ static const struct zxdg_toplevel_v6_interface sl_xdg_toplevel_implementation =
- sl_xdg_toplevel_unset_fullscreen, sl_xdg_toplevel_set_minimized};
+- {sl_xdg_toplevel_destroy, sl_xdg_toplevel_set_parent,
+- sl_xdg_toplevel_set_title, sl_xdg_toplevel_set_app_id,
+- sl_xdg_toplevel_show_window_menu, sl_xdg_toplevel_move,
+- sl_xdg_toplevel_resize, sl_xdg_toplevel_set_max_size,
+- sl_xdg_toplevel_set_min_size, sl_xdg_toplevel_set_maximized,
+- sl_xdg_toplevel_unset_maximized, sl_xdg_toplevel_set_fullscreen,
+- sl_xdg_toplevel_unset_fullscreen, sl_xdg_toplevel_set_minimized};
++static const struct xdg_toplevel_interface sl_xdg_toplevel_implementation = {
++ sl_xdg_toplevel_destroy, sl_xdg_toplevel_set_parent,
++ sl_xdg_toplevel_set_title, sl_xdg_toplevel_set_app_id,
++ sl_xdg_toplevel_show_window_menu, sl_xdg_toplevel_move,
++ sl_xdg_toplevel_resize, sl_xdg_toplevel_set_max_size,
++ sl_xdg_toplevel_set_min_size, sl_xdg_toplevel_set_maximized,
++ sl_xdg_toplevel_unset_maximized, sl_xdg_toplevel_set_fullscreen,
++ sl_xdg_toplevel_unset_fullscreen, sl_xdg_toplevel_set_minimized};

static void sl_xdg_toplevel_configure(void* data,
- struct zxdg_toplevel_v6* xdg_toplevel,
@@ -924,22 +1105,23 @@ index ecd0fc647..a3ba0d6e1 100644
int32_t width,
int32_t height,
struct wl_array* states) {
- struct sl_host_xdg_toplevel* host =
-- zxdg_toplevel_v6_get_user_data(xdg_toplevel);
-+ xdg_toplevel_get_user_data(xdg_toplevel);
+ struct sl_host_xdg_toplevel* host = static_cast<sl_host_xdg_toplevel*>(
+- zxdg_toplevel_v6_get_user_data(xdg_toplevel));
++ xdg_toplevel_get_user_data(xdg_toplevel));
double scale = host->ctx->scale;

- zxdg_toplevel_v6_send_configure(host->resource, width * scale, height * scale,
+- states);
+ xdg_toplevel_send_configure(host->resource, width * scale, height * scale,
- states);
++ states);
}

static void sl_xdg_toplevel_close(void* data,
- struct zxdg_toplevel_v6* xdg_toplevel) {
+ struct xdg_toplevel* xdg_toplevel) {
- struct sl_host_xdg_toplevel* host =
-- zxdg_toplevel_v6_get_user_data(xdg_toplevel);
-+ xdg_toplevel_get_user_data(xdg_toplevel);
+ struct sl_host_xdg_toplevel* host = static_cast<sl_host_xdg_toplevel*>(
+- zxdg_toplevel_v6_get_user_data(xdg_toplevel));
++ xdg_toplevel_get_user_data(xdg_toplevel));

- zxdg_toplevel_v6_send_close(host->resource);
+ xdg_toplevel_send_close(host->resource);
@@ -950,20 +1132,20 @@ index ecd0fc647..a3ba0d6e1 100644
sl_xdg_toplevel_configure, sl_xdg_toplevel_close};

static void sl_destroy_host_xdg_toplevel(struct wl_resource* resource) {
- struct sl_host_xdg_toplevel* host = wl_resource_get_user_data(resource);
+ struct sl_host_xdg_toplevel* host =
+ static_cast<sl_host_xdg_toplevel*>(wl_resource_get_user_data(resource));

- zxdg_toplevel_v6_destroy(host->proxy);
+ xdg_toplevel_destroy(host->proxy);
wl_resource_set_user_data(resource, NULL);
free(host);
}
-@@ -367,14 +367,15 @@ static void sl_xdg_surface_get_toplevel(struct wl_client* client,
+@@ -403,14 +398,14 @@ static void sl_xdg_surface_get_toplevel(struct wl_client* client,

host_xdg_toplevel->ctx = host->ctx;
host_xdg_toplevel->resource =
- wl_resource_create(client, &zxdg_toplevel_v6_interface, 1, id);
-+ wl_resource_create(client, &xdg_toplevel_interface,
-+ wl_resource_get_version(resource), id);
++ wl_resource_create(client, &xdg_toplevel_interface, 1, id);
wl_resource_set_implementation(
host_xdg_toplevel->resource, &sl_xdg_toplevel_implementation,
host_xdg_toplevel, sl_destroy_host_xdg_toplevel);
@@ -973,34 +1155,44 @@ index ecd0fc647..a3ba0d6e1 100644
- &sl_xdg_toplevel_listener, host_xdg_toplevel);
+ host_xdg_toplevel->proxy = xdg_surface_get_toplevel(host->proxy);
+ xdg_toplevel_set_user_data(host_xdg_toplevel->proxy, host_xdg_toplevel);
-+ xdg_toplevel_add_listener(host_xdg_toplevel->proxy,
-+ &sl_xdg_toplevel_listener, host_xdg_toplevel);
++ xdg_toplevel_add_listener(host_xdg_toplevel->proxy, &sl_xdg_toplevel_listener,
++ host_xdg_toplevel);
}

static void sl_xdg_surface_get_popup(struct wl_client* client,
-@@ -394,15 +395,16 @@ static void sl_xdg_surface_get_popup(struct wl_client* client,
+@@ -421,7 +416,7 @@ static void sl_xdg_surface_get_popup(struct wl_client* client,
+ struct sl_host_xdg_surface* host =
+ static_cast<sl_host_xdg_surface*>(wl_resource_get_user_data(resource));
+ struct sl_host_xdg_surface* host_parent = static_cast<sl_host_xdg_surface*>(
+- wl_resource_get_user_data(parent_resource));
++ parent_resource ? wl_resource_get_user_data(parent_resource) : NULL);
+ struct sl_host_xdg_positioner* host_positioner =
+ static_cast<sl_host_xdg_positioner*>(
+ wl_resource_get_user_data(positioner_resource));
+@@ -431,15 +426,16 @@ static void sl_xdg_surface_get_popup(struct wl_client* client,

host_xdg_popup->ctx = host->ctx;
host_xdg_popup->resource =
- wl_resource_create(client, &zxdg_popup_v6_interface, 1, id);
-+ wl_resource_create(client, &xdg_popup_interface,
-+ wl_resource_get_version(resource), id);
++ wl_resource_create(client, &xdg_popup_interface, 1, id);
wl_resource_set_implementation(host_xdg_popup->resource,
&sl_xdg_popup_implementation, host_xdg_popup,
sl_destroy_host_xdg_popup);
- host_xdg_popup->proxy = zxdg_surface_v6_get_popup(
-+ host_xdg_popup->proxy = xdg_surface_get_popup(
- host->proxy, host_parent->proxy, host_positioner->proxy);
+- host->proxy, host_parent->proxy, host_positioner->proxy);
- zxdg_popup_v6_set_user_data(host_xdg_popup->proxy, host_xdg_popup);
- zxdg_popup_v6_add_listener(host_xdg_popup->proxy, &sl_xdg_popup_listener,
- host_xdg_popup);
++ host_xdg_popup->proxy = xdg_surface_get_popup(
++ host->proxy, host_parent ? host_parent->proxy : NULL,
++ host_positioner->proxy);
+ xdg_popup_set_user_data(host_xdg_popup->proxy, host_xdg_popup);
+ xdg_popup_add_listener(host_xdg_popup->proxy, &sl_xdg_popup_listener,
+ host_xdg_popup);
- }
+ } // NOLINT(whitespace/indent)

static void sl_xdg_surface_set_window_geometry(struct wl_client* client,
-@@ -420,7 +422,7 @@ static void sl_xdg_surface_set_window_geometry(struct wl_client* client,
+@@ -458,7 +454,7 @@ static void sl_xdg_surface_set_window_geometry(struct wl_client* client,
x2 = (x + width) / scale;
y2 = (y + height) / scale;

@@ -1009,9 +1201,9 @@ index ecd0fc647..a3ba0d6e1 100644
}

static void sl_xdg_surface_ack_configure(struct wl_client* client,
-@@ -428,63 +430,64 @@ static void sl_xdg_surface_ack_configure(struct wl_client* client,
- uint32_t serial) {
- struct sl_host_xdg_surface* host = wl_resource_get_user_data(resource);
+@@ -467,31 +463,31 @@ static void sl_xdg_surface_ack_configure(struct wl_client* client,
+ struct sl_host_xdg_surface* host =
+ static_cast<sl_host_xdg_surface*>(wl_resource_get_user_data(resource));

- zxdg_surface_v6_ack_configure(host->proxy, serial);
+ xdg_surface_ack_configure(host->proxy, serial);
@@ -1027,8 +1219,9 @@ index ecd0fc647..a3ba0d6e1 100644
- struct zxdg_surface_v6* xdg_surface,
+ struct xdg_surface* xdg_surface,
uint32_t serial) {
-- struct sl_host_xdg_surface* host = zxdg_surface_v6_get_user_data(xdg_surface);
-+ struct sl_host_xdg_surface* host = xdg_surface_get_user_data(xdg_surface);
+ struct sl_host_xdg_surface* host = static_cast<sl_host_xdg_surface*>(
+- zxdg_surface_v6_get_user_data(xdg_surface));
++ xdg_surface_get_user_data(xdg_surface));

- zxdg_surface_v6_send_configure(host->resource, serial);
+ xdg_surface_send_configure(host->resource, serial);
@@ -1039,37 +1232,20 @@ index ecd0fc647..a3ba0d6e1 100644
sl_xdg_surface_configure};

static void sl_destroy_host_xdg_surface(struct wl_resource* resource) {
- struct sl_host_xdg_surface* host = wl_resource_get_user_data(resource);
+ struct sl_host_xdg_surface* host =
+ static_cast<sl_host_xdg_surface*>(wl_resource_get_user_data(resource));

- zxdg_surface_v6_destroy(host->proxy);
+ xdg_surface_destroy(host->proxy);
wl_resource_set_user_data(resource, NULL);
free(host);
}
-
--static void sl_xdg_shell_destroy(struct wl_client* client,
-+static void sl_xdg_wm_base_destroy(struct wl_client* client,
- struct wl_resource* resource) {
- wl_resource_destroy(resource);
- }
-
--static void sl_xdg_shell_create_positioner(struct wl_client* client,
-+static void sl_xdg_wm_base_create_positioner(struct wl_client* client,
- struct wl_resource* resource,
- uint32_t id) {
-- struct sl_host_xdg_shell* host = wl_resource_get_user_data(resource);
-+ struct sl_host_xdg_wm_base* host = wl_resource_get_user_data(resource);
- struct sl_host_xdg_positioner* host_xdg_positioner;
-
- host_xdg_positioner = malloc(sizeof(*host_xdg_positioner));
- assert(host_xdg_positioner);
+@@ -513,13 +509,12 @@ static void sl_xdg_shell_create_positioner(struct wl_client* client,

host_xdg_positioner->ctx = host->ctx;
-- host_xdg_positioner->resource =
+ host_xdg_positioner->resource =
- wl_resource_create(client, &zxdg_positioner_v6_interface, 1, id);
-+ host_xdg_positioner->resource = wl_resource_create(
-+ client, &xdg_positioner_interface,
-+ wl_resource_get_version(resource), id);
++ wl_resource_create(client, &xdg_positioner_interface, 1, id);
wl_resource_set_implementation(
host_xdg_positioner->resource, &sl_xdg_positioner_implementation,
host_xdg_positioner, sl_destroy_host_xdg_positioner);
@@ -1077,29 +1253,16 @@ index ecd0fc647..a3ba0d6e1 100644
- zxdg_positioner_v6_set_user_data(host_xdg_positioner->proxy,
- host_xdg_positioner);
+ host_xdg_positioner->proxy = xdg_wm_base_create_positioner(host->proxy);
-+ xdg_positioner_set_user_data(host_xdg_positioner->proxy,
-+ host_xdg_positioner);
++ xdg_positioner_set_user_data(host_xdg_positioner->proxy, host_xdg_positioner);
}

--static void sl_xdg_shell_get_xdg_surface(struct wl_client* client,
-+static void sl_xdg_wm_base_get_xdg_surface(struct wl_client* client,
- struct wl_resource* resource,
- uint32_t id,
- struct wl_resource* surface_resource) {
-- struct sl_host_xdg_shell* host = wl_resource_get_user_data(resource);
-+ struct sl_host_xdg_wm_base* host = wl_resource_get_user_data(resource);
- struct sl_host_surface* host_surface =
- wl_resource_get_user_data(surface_resource);
- struct sl_host_xdg_surface* host_xdg_surface;
-@@ -493,71 +496,75 @@ static void sl_xdg_shell_get_xdg_surface(struct wl_client* client,
- assert(host_xdg_surface);
+ static void sl_xdg_shell_get_xdg_surface(struct wl_client* client,
+@@ -536,15 +531,15 @@ static void sl_xdg_shell_get_xdg_surface(struct wl_client* client,

host_xdg_surface->ctx = host->ctx;
-- host_xdg_surface->resource =
+ host_xdg_surface->resource =
- wl_resource_create(client, &zxdg_surface_v6_interface, 1, id);
-+ host_xdg_surface->resource = wl_resource_create(
-+ client, &xdg_surface_interface,
-+ wl_resource_get_version(resource), id);
++ wl_resource_create(client, &xdg_surface_interface, 1, id);
wl_resource_set_implementation(host_xdg_surface->resource,
&sl_xdg_surface_implementation,
host_xdg_surface, sl_destroy_host_xdg_surface);
@@ -1110,129 +1273,104 @@ index ecd0fc647..a3ba0d6e1 100644
- &sl_xdg_surface_listener, host_xdg_surface);
+ xdg_wm_base_get_xdg_surface(host->proxy, host_surface->proxy);
+ xdg_surface_set_user_data(host_xdg_surface->proxy, host_xdg_surface);
-+ xdg_surface_add_listener(host_xdg_surface->proxy,
-+ &sl_xdg_surface_listener, host_xdg_surface);
++ xdg_surface_add_listener(host_xdg_surface->proxy, &sl_xdg_surface_listener,
++ host_xdg_surface);
host_surface->has_role = 1;
}

--static void sl_xdg_shell_pong(struct wl_client* client,
-+static void sl_xdg_wm_base_pong(struct wl_client* client,
- struct wl_resource* resource,
- uint32_t serial) {
-- struct sl_host_xdg_shell* host = wl_resource_get_user_data(resource);
-+ struct sl_host_xdg_wm_base* host = wl_resource_get_user_data(resource);
+@@ -554,30 +549,30 @@ static void sl_xdg_shell_pong(struct wl_client* client,
+ struct sl_host_xdg_shell* host =
+ static_cast<sl_host_xdg_shell*>(wl_resource_get_user_data(resource));

- zxdg_shell_v6_pong(host->proxy, serial);
+ xdg_wm_base_pong(host->proxy, serial);
}

-static const struct zxdg_shell_v6_interface sl_xdg_shell_implementation = {
-- sl_xdg_shell_destroy, sl_xdg_shell_create_positioner,
-- sl_xdg_shell_get_xdg_surface, sl_xdg_shell_pong};
-+static const struct xdg_wm_base_interface sl_xdg_wm_base_implementation = {
-+ sl_xdg_wm_base_destroy, sl_xdg_wm_base_create_positioner,
-+ sl_xdg_wm_base_get_xdg_surface, sl_xdg_wm_base_pong};
++static const struct xdg_wm_base_interface sl_xdg_shell_implementation = {
+ sl_xdg_shell_destroy, sl_xdg_shell_create_positioner,
+ sl_xdg_shell_get_xdg_surface, sl_xdg_shell_pong};

--static void sl_xdg_shell_ping(void* data,
+ static void sl_xdg_shell_ping(void* data,
- struct zxdg_shell_v6* xdg_shell,
-+static void sl_xdg_wm_base_ping(void* data,
-+ struct xdg_wm_base* xdg_wm_base,
++ struct xdg_wm_base* xdg_shell,
uint32_t serial) {
-- struct sl_host_xdg_shell* host = zxdg_shell_v6_get_user_data(xdg_shell);
-+ struct sl_host_xdg_wm_base* host = xdg_wm_base_get_user_data(xdg_wm_base);
+ struct sl_host_xdg_shell* host =
+- static_cast<sl_host_xdg_shell*>(zxdg_shell_v6_get_user_data(xdg_shell));
++ static_cast<sl_host_xdg_shell*>(xdg_wm_base_get_user_data(xdg_shell));

- zxdg_shell_v6_send_ping(host->resource, serial);
+ xdg_wm_base_send_ping(host->resource, serial);
}

-static const struct zxdg_shell_v6_listener sl_xdg_shell_listener = {
-- sl_xdg_shell_ping};
-+static const struct xdg_wm_base_listener sl_xdg_wm_base_listener = {
-+ sl_xdg_wm_base_ping};
++static const struct xdg_wm_base_listener sl_xdg_shell_listener = {
+ sl_xdg_shell_ping};

--static void sl_destroy_host_xdg_shell(struct wl_resource* resource) {
-- struct sl_host_xdg_shell* host = wl_resource_get_user_data(resource);
-+static void sl_destroy_host_xdg_wm_base(struct wl_resource* resource) {
-+ struct sl_host_xdg_wm_base* host = wl_resource_get_user_data(resource);
+ static void sl_destroy_host_xdg_shell(struct wl_resource* resource) {
+ struct sl_host_xdg_shell* host =
+ static_cast<sl_host_xdg_shell*>(wl_resource_get_user_data(resource));

- zxdg_shell_v6_destroy(host->proxy);
+ xdg_wm_base_destroy(host->proxy);
wl_resource_set_user_data(resource, NULL);
free(host);
}
-
--static void sl_bind_host_xdg_shell(struct wl_client* client,
-+static void sl_bind_host_xdg_wm_base(struct wl_client* client,
- void* data,
- uint32_t version,
- uint32_t id) {
- struct sl_context* ctx = (struct sl_context*)data;
-- struct sl_host_xdg_shell* host;
-+ struct sl_host_xdg_wm_base* host;
-
- host = malloc(sizeof(*host));
+@@ -591,17 +586,17 @@ static void sl_bind_host_xdg_shell(struct wl_client* client,
+ static_cast<sl_host_xdg_shell*>(malloc(sizeof(*host)));
assert(host);
host->ctx = ctx;
- host->resource = wl_resource_create(client, &zxdg_shell_v6_interface, 1, id);
-- wl_resource_set_implementation(host->resource, &sl_xdg_shell_implementation,
-- host, sl_destroy_host_xdg_shell);
-+ host->resource = wl_resource_create(client, &xdg_wm_base_interface,
-+ ctx->xdg_wm_base->id, id);
-+ wl_resource_set_implementation(host->resource, &sl_xdg_wm_base_implementation,
-+ host, sl_destroy_host_xdg_wm_base);
- host->proxy =
++ host->resource = wl_resource_create(client, &xdg_wm_base_interface, 1, id);
+ wl_resource_set_implementation(host->resource, &sl_xdg_shell_implementation,
+ host, sl_destroy_host_xdg_shell);
+- host->proxy = static_cast<zxdg_shell_v6*>(
++ host->proxy = static_cast<xdg_wm_base*>(
wl_registry_bind(wl_display_get_registry(ctx->display),
-- ctx->xdg_shell->id, &zxdg_shell_v6_interface, 1);
+- ctx->xdg_shell->id, &zxdg_shell_v6_interface, 1));
- zxdg_shell_v6_set_user_data(host->proxy, host);
- zxdg_shell_v6_add_listener(host->proxy, &sl_xdg_shell_listener, host);
-+ ctx->xdg_wm_base->id, &xdg_wm_base_interface,
-+ ctx->xdg_wm_base->version);
++ ctx->xdg_shell->id, &xdg_wm_base_interface, 1));
+ xdg_wm_base_set_user_data(host->proxy, host);
-+ xdg_wm_base_add_listener(host->proxy, &sl_xdg_wm_base_listener, host);
++ xdg_wm_base_add_listener(host->proxy, &sl_xdg_shell_listener, host);
}

--struct sl_global* sl_xdg_shell_global_create(struct sl_context* ctx) {
+ struct sl_global* sl_xdg_shell_global_create(struct sl_context* ctx) {
- return sl_global_create(ctx, &zxdg_shell_v6_interface, 1, ctx,
-- sl_bind_host_xdg_shell);
-+struct sl_global* sl_xdg_wm_base_global_create(struct sl_context* ctx) {
-+ return sl_global_create(ctx, &xdg_wm_base_interface,
-+ ctx->xdg_wm_base->version, ctx,
-+ sl_bind_host_xdg_wm_base);
++ return sl_global_create(ctx, &xdg_wm_base_interface, 1, ctx,
+ sl_bind_host_xdg_shell);
}
-diff --git a/vm_tools/sommelier/sommelier.c b/vm_tools/sommelier/sommelier.c
-index 98e101135..9a56f350d 100644
---- a/vm_tools/sommelier/sommelier.c
-+++ b/vm_tools/sommelier/sommelier.c
-@@ -35,7 +35,7 @@
- #include "relative-pointer-unstable-v1-client-protocol.h"
- #include "text-input-unstable-v1-client-protocol.h"
- #include "viewporter-client-protocol.h"
--#include "xdg-shell-unstable-v6-client-protocol.h"
-+#include "xdg-shell-client-protocol.h"
+diff --git a/vm_tools/sommelier/sommelier.cc b/vm_tools/sommelier/sommelier.cc
+index 0560672d46..8435dbe082 100644
+--- a/vm_tools/sommelier/sommelier.cc
++++ b/vm_tools/sommelier/sommelier.cc
+@@ -39,7 +39,7 @@
+ #include "relative-pointer-unstable-v1-client-protocol.h" // NOLINT(build/include_directory)
+ #include "text-input-unstable-v1-client-protocol.h" // NOLINT(build/include_directory)
+ #include "viewporter-client-protocol.h" // NOLINT(build/include_directory)
+-#include "xdg-shell-unstable-v6-client-protocol.h" // NOLINT(build/include_directory)
++#include "xdg-shell-client-protocol.h" // NOLINT(build/include_directory)

#define errno_assert(rv) \
{ \
-@@ -281,14 +281,14 @@ void sl_sync_point_destroy(struct sl_sync_point* sync_point) {
- free(sync_point);
+@@ -376,13 +376,13 @@ void sl_sync_point_destroy(struct sl_sync_point* sync_point) {
}

--static void sl_internal_xdg_shell_ping(void* data,
+ static void sl_internal_xdg_shell_ping(void* data,
- struct zxdg_shell_v6* xdg_shell,
-+static void sl_internal_xdg_wm_base_ping(void* data,
-+ struct xdg_wm_base* xdg_wm_base,
++ struct xdg_wm_base* xdg_shell,
uint32_t serial) {
+ TRACE_EVENT("shell", "sl_internal_xdg_shell_ping");
- zxdg_shell_v6_pong(xdg_shell, serial);
-+ xdg_wm_base_pong(xdg_wm_base, serial);
++ xdg_wm_base_pong(xdg_shell, serial);
}

-static const struct zxdg_shell_v6_listener sl_internal_xdg_shell_listener = {
-- sl_internal_xdg_shell_ping};
-+static const struct xdg_wm_base_listener sl_internal_xdg_wm_base_listener = {
-+ sl_internal_xdg_wm_base_ping};
++static const struct xdg_wm_base_listener sl_internal_xdg_shell_listener = {
+ sl_internal_xdg_shell_ping};

static void sl_send_configure_notify(struct sl_window* window) {
- xcb_configure_notify_event_t event = {
-@@ -451,8 +451,8 @@ int sl_process_pending_configure_acks(struct sl_window* window,
+@@ -549,8 +549,8 @@ int sl_process_pending_configure_acks(struct sl_window* window,
}

if (window->xdg_surface) {
@@ -1243,24 +1381,30 @@ index 98e101135..9a56f350d 100644
}
window->pending_config.serial = 0;

-@@ -463,8 +463,8 @@ int sl_process_pending_configure_acks(struct sl_window* window,
+@@ -560,11 +560,12 @@ int sl_process_pending_configure_acks(struct sl_window* window,
+ return 1;
}

- static void sl_internal_xdg_surface_configure(
+-static void sl_internal_xdg_surface_configure(
- void* data, struct zxdg_surface_v6* xdg_surface, uint32_t serial) {
-- struct sl_window* window = zxdg_surface_v6_get_user_data(xdg_surface);
-+ void* data, struct xdg_surface* xdg_surface, uint32_t serial) {
-+ struct sl_window* window = xdg_surface_get_user_data(xdg_surface);
++static void sl_internal_xdg_surface_configure(void* data,
++ struct xdg_surface* xdg_surface,
++ uint32_t serial) {
+ TRACE_EVENT("surface", "sl_internal_xdg_surface_configure");
+ struct sl_window* window =
+- static_cast<sl_window*>(zxdg_surface_v6_get_user_data(xdg_surface));
++ static_cast<sl_window*>(xdg_surface_get_user_data(xdg_surface));

window->next_config.serial = serial;
if (!window->pending_config.serial) {
-@@ -485,16 +485,16 @@ static void sl_internal_xdg_surface_configure(
+@@ -586,18 +587,18 @@ static void sl_internal_xdg_surface_configure(
}
}

-static const struct zxdg_surface_v6_listener sl_internal_xdg_surface_listener =
-+static const struct xdg_surface_listener sl_internal_xdg_surface_listener =
- {sl_internal_xdg_surface_configure};
+- {sl_internal_xdg_surface_configure};
++static const struct xdg_surface_listener sl_internal_xdg_surface_listener = {
++ sl_internal_xdg_surface_configure};

static void sl_internal_xdg_toplevel_configure(
void* data,
@@ -1269,15 +1413,17 @@ index 98e101135..9a56f350d 100644
int32_t width,
int32_t height,
struct wl_array* states) {
-- struct sl_window* window = zxdg_toplevel_v6_get_user_data(xdg_toplevel);
-+ struct sl_window* window = xdg_toplevel_get_user_data(xdg_toplevel);
+ TRACE_EVENT("other", "sl_internal_xdg_toplevel_configure");
+ struct sl_window* window =
+- static_cast<sl_window*>(zxdg_toplevel_v6_get_user_data(xdg_toplevel));
++ static_cast<sl_window*>(xdg_toplevel_get_user_data(xdg_toplevel));
int activated = 0;
uint32_t* state;
int i = 0;
-@@ -524,21 +524,21 @@ static void sl_internal_xdg_toplevel_configure(
+@@ -627,21 +628,21 @@ static void sl_internal_xdg_toplevel_configure(

window->allow_resize = 1;
- wl_array_for_each(state, states) {
+ sl_array_for_each(state, states) {
- if (*state == ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN) {
+ if (*state == XDG_TOPLEVEL_STATE_FULLSCREEN) {
window->allow_resize = 0;
@@ -1300,25 +1446,30 @@ index 98e101135..9a56f350d 100644
window->allow_resize = 0;
}

-@@ -554,8 +554,8 @@ static void sl_internal_xdg_toplevel_configure(
+@@ -656,11 +657,11 @@ static void sl_internal_xdg_toplevel_configure(
+ window->next_config.states_length = i;
}

- static void sl_internal_xdg_toplevel_close(
+-static void sl_internal_xdg_toplevel_close(
- void* data, struct zxdg_toplevel_v6* xdg_toplevel) {
-- struct sl_window* window = zxdg_toplevel_v6_get_user_data(xdg_toplevel);
-+ void* data, struct xdg_toplevel* xdg_toplevel) {
-+ struct sl_window* window = xdg_toplevel_get_user_data(xdg_toplevel);
- xcb_client_message_event_t event = {
- .response_type = XCB_CLIENT_MESSAGE,
- .format = 32,
-@@ -572,21 +572,21 @@ static void sl_internal_xdg_toplevel_close(
++static void sl_internal_xdg_toplevel_close(void* data,
++ struct xdg_toplevel* xdg_toplevel) {
+ TRACE_EVENT("other", "sl_internal_xdg_toplevel_close");
+ struct sl_window* window =
+- static_cast<sl_window*>(zxdg_toplevel_v6_get_user_data(xdg_toplevel));
++ static_cast<sl_window*>(xdg_toplevel_get_user_data(xdg_toplevel));
+ xcb_client_message_event_t event = {};
+ event.response_type = XCB_CLIENT_MESSAGE;
+ event.format = 32;
+@@ -673,21 +674,20 @@ static void sl_internal_xdg_toplevel_close(
XCB_EVENT_MASK_NO_EVENT, (const char*)&event);
}

-static const struct zxdg_toplevel_v6_listener
-+static const struct xdg_toplevel_listener
- sl_internal_xdg_toplevel_listener = {sl_internal_xdg_toplevel_configure,
- sl_internal_xdg_toplevel_close};
+- sl_internal_xdg_toplevel_listener = {sl_internal_xdg_toplevel_configure,
+- sl_internal_xdg_toplevel_close};
++static const struct xdg_toplevel_listener sl_internal_xdg_toplevel_listener = {
++ sl_internal_xdg_toplevel_configure, sl_internal_xdg_toplevel_close};

static void sl_internal_xdg_popup_configure(void* data,
- struct zxdg_popup_v6* xdg_popup,
@@ -1337,7 +1488,7 @@ index 98e101135..9a56f350d 100644
sl_internal_xdg_popup_configure, sl_internal_xdg_popup_done};

static void sl_window_set_wm_state(struct sl_window* window, int state) {
-@@ -654,15 +654,15 @@ void sl_window_update(struct sl_window* window) {
+@@ -759,15 +759,15 @@ void sl_window_update(struct sl_window* window) {
window->aura_surface = NULL;
}
if (window->xdg_toplevel) {
@@ -1356,18 +1507,7 @@ index 98e101135..9a56f350d 100644
window->xdg_surface = NULL;
}
window->realized = 0;
-@@ -673,8 +673,8 @@ void sl_window_update(struct sl_window* window) {
- assert(host_surface);
- assert(!host_surface->has_role);
-
-- assert(ctx->xdg_shell);
-- assert(ctx->xdg_shell->internal);
-+ assert(ctx->xdg_wm_base);
-+ assert(ctx->xdg_wm_base->internal);
-
- if (window->managed) {
- if (window->transient_for != XCB_WINDOW_NONE) {
-@@ -736,11 +736,11 @@ void sl_window_update(struct sl_window* window) {
+@@ -843,11 +843,11 @@ void sl_window_update(struct sl_window* window) {
}

if (!window->xdg_surface) {
@@ -1376,25 +1516,26 @@ index 98e101135..9a56f350d 100644
- zxdg_surface_v6_set_user_data(window->xdg_surface, window);
- zxdg_surface_v6_add_listener(window->xdg_surface,
- &sl_internal_xdg_surface_listener, window);
-+ window->xdg_surface = xdg_wm_base_get_xdg_surface(
-+ ctx->xdg_wm_base->internal, host_surface->proxy);
++ window->xdg_surface = xdg_wm_base_get_xdg_surface(ctx->xdg_shell->internal,
++ host_surface->proxy);
+ xdg_surface_set_user_data(window->xdg_surface, window);
+ xdg_surface_add_listener(window->xdg_surface,
+ &sl_internal_xdg_surface_listener, window);
}

if (ctx->aura_shell) {
-@@ -770,50 +770,50 @@ void sl_window_update(struct sl_window* window) {
+@@ -882,50 +882,46 @@ void sl_window_update(struct sl_window* window) {
// window is closed.
if (ctx->xwayland || !parent) {
if (!window->xdg_toplevel) {
- window->xdg_toplevel = zxdg_surface_v6_get_toplevel(window->xdg_surface);
- zxdg_toplevel_v6_set_user_data(window->xdg_toplevel, window);
- zxdg_toplevel_v6_add_listener(window->xdg_toplevel,
+- &sl_internal_xdg_toplevel_listener, window);
+ window->xdg_toplevel = xdg_surface_get_toplevel(window->xdg_surface);
+ xdg_toplevel_set_user_data(window->xdg_toplevel, window);
+ xdg_toplevel_add_listener(window->xdg_toplevel,
- &sl_internal_xdg_toplevel_listener, window);
++ &sl_internal_xdg_toplevel_listener, window);
}
if (parent)
- zxdg_toplevel_v6_set_parent(window->xdg_toplevel, parent->xdg_toplevel);
@@ -1404,15 +1545,19 @@ index 98e101135..9a56f350d 100644
+ xdg_toplevel_set_title(window->xdg_toplevel, window->name);
if (window->size_flags & P_MIN_SIZE) {
- zxdg_toplevel_v6_set_min_size(window->xdg_toplevel,
+- window->min_width / ctx->scale,
+- window->min_height / ctx->scale);
+ xdg_toplevel_set_min_size(window->xdg_toplevel,
- window->min_width / ctx->scale,
- window->min_height / ctx->scale);
++ window->min_width / ctx->scale,
++ window->min_height / ctx->scale);
}
if (window->size_flags & P_MAX_SIZE) {
- zxdg_toplevel_v6_set_max_size(window->xdg_toplevel,
+- window->max_width / ctx->scale,
+- window->max_height / ctx->scale);
+ xdg_toplevel_set_max_size(window->xdg_toplevel,
- window->max_width / ctx->scale,
- window->max_height / ctx->scale);
++ window->max_width / ctx->scale,
++ window->max_height / ctx->scale);
}
if (window->maximized) {
- zxdg_toplevel_v6_set_maximized(window->xdg_toplevel);
@@ -1423,97 +1568,73 @@ index 98e101135..9a56f350d 100644
+ struct xdg_positioner* positioner;

- positioner = zxdg_shell_v6_create_positioner(ctx->xdg_shell->internal);
-+ positioner = xdg_wm_base_create_positioner(ctx->xdg_wm_base->internal);
++ positioner = xdg_wm_base_create_positioner(ctx->xdg_shell->internal);
assert(positioner);
- zxdg_positioner_v6_set_anchor(
-+ xdg_positioner_set_anchor(
- positioner,
+- positioner,
- ZXDG_POSITIONER_V6_ANCHOR_TOP | ZXDG_POSITIONER_V6_ANCHOR_LEFT);
- zxdg_positioner_v6_set_gravity(
-+ XDG_POSITIONER_ANCHOR_TOP | XDG_POSITIONER_ANCHOR_LEFT);
-+ xdg_positioner_set_gravity(
- positioner,
+- positioner,
- ZXDG_POSITIONER_V6_GRAVITY_BOTTOM | ZXDG_POSITIONER_V6_GRAVITY_RIGHT);
- zxdg_positioner_v6_set_anchor_rect(
-+ XDG_POSITIONER_GRAVITY_BOTTOM | XDG_POSITIONER_GRAVITY_RIGHT);
-+ xdg_positioner_set_anchor_rect(
- positioner, (window->x - parent->x) / ctx->scale,
- (window->y - parent->y) / ctx->scale, 1, 1);
+- positioner, (window->x - parent->x) / ctx->scale,
+- (window->y - parent->y) / ctx->scale, 1, 1);
++ xdg_positioner_set_anchor(positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT);
++ xdg_positioner_set_gravity(positioner, XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT);
++ xdg_positioner_set_anchor_rect(positioner,
++ (window->x - parent->x) / ctx->scale,
++ (window->y - parent->y) / ctx->scale, 1, 1);

- window->xdg_popup = zxdg_surface_v6_get_popup(
-+ window->xdg_popup = xdg_surface_get_popup(
- window->xdg_surface, parent->xdg_surface, positioner);
+- window->xdg_surface, parent->xdg_surface, positioner);
- zxdg_popup_v6_set_user_data(window->xdg_popup, window);
- zxdg_popup_v6_add_listener(window->xdg_popup,
+- &sl_internal_xdg_popup_listener, window);
++ window->xdg_popup = xdg_surface_get_popup(window->xdg_surface,
++ parent->xdg_surface, positioner);
+ xdg_popup_set_user_data(window->xdg_popup, window);
-+ xdg_popup_add_listener(window->xdg_popup,
- &sl_internal_xdg_popup_listener, window);
++ xdg_popup_add_listener(window->xdg_popup, &sl_internal_xdg_popup_listener,
++ window);

- zxdg_positioner_v6_destroy(positioner);
+ xdg_positioner_destroy(positioner);
}

if ((window->size_flags & (US_POSITION | P_POSITION)) && parent &&
-@@ -1177,22 +1177,23 @@ static void sl_registry_handler(void* data,
+@@ -1326,7 +1322,7 @@ static void sl_registry_handler(void* data,
data_device_manager->host_global =
sl_data_device_manager_global_create(ctx);
}
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
-- struct sl_xdg_shell* xdg_shell = malloc(sizeof(struct sl_xdg_shell));
-- assert(xdg_shell);
-- xdg_shell->ctx = ctx;
-- xdg_shell->id = id;
-- xdg_shell->internal = NULL;
-- xdg_shell->host_global = NULL;
-- assert(!ctx->xdg_shell);
-- ctx->xdg_shell = xdg_shell;
+ } else if (strcmp(interface, "xdg_wm_base") == 0) {
-+ struct sl_xdg_wm_base* xdg_wm_base = malloc(sizeof(struct sl_xdg_wm_base));
-+ assert(xdg_wm_base);
-+ xdg_wm_base->ctx = ctx;
-+ xdg_wm_base->id = id;
-+ xdg_wm_base->version = MIN(2, version);
-+ xdg_wm_base->internal = NULL;
-+ xdg_wm_base->host_global = NULL;
-+ assert(!ctx->xdg_wm_base);
-+ ctx->xdg_wm_base = xdg_wm_base;
+ struct sl_xdg_shell* xdg_shell =
+ static_cast<sl_xdg_shell*>(malloc(sizeof(struct sl_xdg_shell)));
+ assert(xdg_shell);
+@@ -1337,10 +1333,10 @@ static void sl_registry_handler(void* data,
+ assert(!ctx->xdg_shell);
+ ctx->xdg_shell = xdg_shell;
if (ctx->xwayland) {
-- xdg_shell->internal =
-- wl_registry_bind(registry, id, &zxdg_shell_v6_interface, 1);
+- xdg_shell->internal = static_cast<zxdg_shell_v6*>(
+- wl_registry_bind(registry, id, &zxdg_shell_v6_interface, 1));
- zxdg_shell_v6_add_listener(xdg_shell->internal,
- &sl_internal_xdg_shell_listener, NULL);
-+ xdg_wm_base->internal =
-+ wl_registry_bind(registry, id, &xdg_wm_base_interface, 1);
-+ xdg_wm_base_add_listener(xdg_wm_base->internal,
-+ &sl_internal_xdg_wm_base_listener, NULL);
++ xdg_shell->internal = static_cast<xdg_wm_base*>(
++ wl_registry_bind(registry, id, &xdg_wm_base_interface, 1));
++ xdg_wm_base_add_listener(xdg_shell->internal,
++ &sl_internal_xdg_shell_listener, NULL);
} else {
-- xdg_shell->host_global = sl_xdg_shell_global_create(ctx);
-+ xdg_wm_base->host_global = sl_xdg_wm_base_global_create(ctx);
+ xdg_shell->host_global = sl_xdg_shell_global_create(ctx);
}
- } else if (strcmp(interface, "zaura_shell") == 0) {
- if (version >= MIN_AURA_SHELL_VERSION) {
-@@ -1299,13 +1300,13 @@ static void sl_registry_remover(void* data,
- ctx->data_device_manager = NULL;
- return;
- }
-- if (ctx->xdg_shell && ctx->xdg_shell->id == id) {
-- if (ctx->xdg_shell->host_global)
-- sl_global_destroy(ctx->xdg_shell->host_global);
-- if (ctx->xdg_shell->internal)
+@@ -1473,7 +1469,7 @@ static void sl_registry_remover(void* data,
+ if (ctx->xdg_shell->host_global)
+ sl_global_destroy(ctx->xdg_shell->host_global);
+ if (ctx->xdg_shell->internal)
- zxdg_shell_v6_destroy(ctx->xdg_shell->internal);
-- free(ctx->xdg_shell);
-- ctx->xdg_shell = NULL;
-+ if (ctx->xdg_wm_base && ctx->xdg_wm_base->id == id) {
-+ if (ctx->xdg_wm_base->host_global)
-+ sl_global_destroy(ctx->xdg_wm_base->host_global);
-+ if (ctx->xdg_wm_base->internal)
-+ xdg_wm_base_destroy(ctx->xdg_wm_base->internal);
-+ free(ctx->xdg_wm_base);
-+ ctx->xdg_wm_base = NULL;
++ xdg_wm_base_destroy(ctx->xdg_shell->internal);
+ free(ctx->xdg_shell);
+ ctx->xdg_shell = NULL;
return;
- }
- if (ctx->aura_shell && ctx->aura_shell->id == id) {
-@@ -1467,11 +1468,11 @@ static void sl_destroy_window(struct sl_window* window) {
+@@ -1650,11 +1646,11 @@ static void sl_destroy_window(struct sl_window* window) {
}

if (window->xdg_popup)
@@ -1528,7 +1649,7 @@ index 98e101135..9a56f350d 100644
if (window->aura_surface)
zaura_surface_destroy(window->aura_surface);

-@@ -1915,15 +1916,15 @@ static void sl_handle_configure_request(struct sl_context* ctx,
+@@ -2118,15 +2114,15 @@ static void sl_handle_configure_request(struct sl_context* ctx,
// that matching contents will arrive.
if (window->xdg_toplevel) {
if (window->pending_config.serial) {
@@ -1548,7 +1669,7 @@ index 98e101135..9a56f350d 100644
window->next_config.serial = 0;
window->next_config.mask = 0;
window->next_config.states_length = 0;
-@@ -2044,23 +2045,23 @@ static void sl_handle_configure_notify(struct sl_context* ctx,
+@@ -2247,23 +2243,23 @@ static void sl_handle_configure_notify(struct sl_context* ctx,
static uint32_t sl_resize_edge(int net_wm_moveresize_size) {
switch (net_wm_moveresize_size) {
case NET_WM_MOVERESIZE_SIZE_TOPLEFT:
@@ -1581,13 +1702,14 @@ index 98e101135..9a56f350d 100644
}
}

-@@ -2107,15 +2108,15 @@ static void sl_handle_client_message(struct sl_context* ctx,
+@@ -2362,16 +2358,16 @@ static void sl_handle_client_message(struct sl_context* ctx,
return;

if (event->data.data32[2] == NET_WM_MOVERESIZE_MOVE) {
- zxdg_toplevel_v6_move(window->xdg_toplevel, seat->proxy,
+- seat->seat->last_serial);
+ xdg_toplevel_move(window->xdg_toplevel, seat->proxy,
- seat->seat->last_serial);
++ seat->seat->last_serial);
} else {
uint32_t edge = sl_resize_edge(event->data.data32[2]);

@@ -1596,13 +1718,15 @@ index 98e101135..9a56f350d 100644
return;

- zxdg_toplevel_v6_resize(window->xdg_toplevel, seat->proxy,
+- seat->seat->last_serial, edge);
+ xdg_toplevel_resize(window->xdg_toplevel, seat->proxy,
- seat->seat->last_serial, edge);
++ seat->seat->last_serial, edge);
}
}
-@@ -2134,24 +2135,24 @@ static void sl_handle_client_message(struct sl_context* ctx,
-
- if (changed[ATOM_NET_WM_STATE_FULLSCREEN]) {
+ } else if (event->type == ctx->atoms[ATOM_NET_WM_STATE].value) {
+@@ -2392,9 +2388,9 @@ static void sl_handle_client_message(struct sl_context* ctx,
+ "action", net_wm_state_to_string(action), "window->name",
+ window->name);
if (action == NET_WM_STATE_ADD)
- zxdg_toplevel_v6_set_fullscreen(window->xdg_toplevel, NULL);
+ xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
@@ -1612,7 +1736,9 @@ index 98e101135..9a56f350d 100644
}

if (changed[ATOM_NET_WM_STATE_MAXIMIZED_VERT] &&
- changed[ATOM_NET_WM_STATE_MAXIMIZED_HORZ]) {
+@@ -2405,9 +2401,9 @@ static void sl_handle_client_message(struct sl_context* ctx,
+ "action", net_wm_state_to_string(action), "window->name",
+ window->name);
if (action == NET_WM_STATE_ADD)
- zxdg_toplevel_v6_set_maximized(window->xdg_toplevel);
+ xdg_toplevel_set_maximized(window->xdg_toplevel);
@@ -1622,15 +1748,16 @@ index 98e101135..9a56f350d 100644
}
}
} else if (event->type == ctx->atoms[ATOM_WM_CHANGE_STATE].value &&
- event->data.data32[0] == WM_STATE_ICONIC) {
- struct sl_window* window = sl_lookup_window(ctx, event->window);
+@@ -2416,7 +2412,7 @@ static void sl_handle_client_message(struct sl_context* ctx,
+ TRACE_EVENT("x11wm", "XCB_CLIENT_MESSAGE: WM_STATE_ICONIC (minimize)",
+ "window->name", window ? window->name : "<unknown>");
if (window && window->xdg_toplevel) {
- zxdg_toplevel_v6_set_minimized(window->xdg_toplevel);
+ xdg_toplevel_set_minimized(window->xdg_toplevel);
}
}
}
-@@ -2164,7 +2165,7 @@ static void sl_handle_focus_in(struct sl_context* ctx,
+@@ -2429,7 +2425,7 @@ static void sl_handle_focus_in(struct sl_context* ctx,
// window was realized.
struct sl_window* parent = sl_lookup_window(ctx, window->transient_for);
if (parent && parent->xdg_toplevel && window->xdg_toplevel)
@@ -1639,7 +1766,7 @@ index 98e101135..9a56f350d 100644
}
}

-@@ -2381,9 +2382,9 @@ static void sl_handle_property_notify(struct sl_context* ctx,
+@@ -2738,9 +2734,9 @@ static void sl_handle_property_notify(struct sl_context* ctx,
return;

if (window->name) {
@@ -1651,14 +1778,16 @@ index 98e101135..9a56f350d 100644
}
} else if (event->atom == XCB_ATOM_WM_CLASS) {
struct sl_window* window = sl_lookup_window(ctx, event->window);
-@@ -2435,19 +2436,19 @@ static void sl_handle_property_notify(struct sl_context* ctx,
+@@ -2796,19 +2792,19 @@ static void sl_handle_property_notify(struct sl_context* ctx,
return;

if (window->size_flags & P_MIN_SIZE) {
- zxdg_toplevel_v6_set_min_size(window->xdg_toplevel,
+- window->min_width / ctx->scale,
+- window->min_height / ctx->scale);
+ xdg_toplevel_set_min_size(window->xdg_toplevel,
- window->min_width / ctx->scale,
- window->min_height / ctx->scale);
++ window->min_width / ctx->scale,
++ window->min_height / ctx->scale);
} else {
- zxdg_toplevel_v6_set_min_size(window->xdg_toplevel, 0, 0);
+ xdg_toplevel_set_min_size(window->xdg_toplevel, 0, 0);
@@ -1666,62 +1795,31 @@ index 98e101135..9a56f350d 100644

if (window->size_flags & P_MAX_SIZE) {
- zxdg_toplevel_v6_set_max_size(window->xdg_toplevel,
+- window->max_width / ctx->scale,
+- window->max_height / ctx->scale);
+ xdg_toplevel_set_max_size(window->xdg_toplevel,
- window->max_width / ctx->scale,
- window->max_height / ctx->scale);
++ window->max_width / ctx->scale,
++ window->max_height / ctx->scale);
} else {
- zxdg_toplevel_v6_set_max_size(window->xdg_toplevel, 0, 0);
+ xdg_toplevel_set_max_size(window->xdg_toplevel, 0, 0);
}
} else if (event->atom == XCB_ATOM_WM_HINTS) {
struct sl_window* window = sl_lookup_window(ctx, event->window);
-@@ -3535,7 +3536,7 @@ int main(int argc, char** argv) {
- .shm = NULL,
- .shell = NULL,
- .data_device_manager = NULL,
-- .xdg_shell = NULL,
-+ .xdg_wm_base = NULL,
- .aura_shell = NULL,
- .viewporter = NULL,
- .linux_dmabuf = NULL,
diff --git a/vm_tools/sommelier/sommelier.h b/vm_tools/sommelier/sommelier.h
-index b851b5c8d..7e6daf773 100644
+index 1e00a0b981..f07a826c99 100644
--- a/vm_tools/sommelier/sommelier.h
+++ b/vm_tools/sommelier/sommelier.h
-@@ -31,7 +31,7 @@ struct sl_shell;
- struct sl_data_device_manager;
- struct sl_data_offer;
- struct sl_data_source;
--struct sl_xdg_shell;
-+struct sl_xdg_wm_base;
- struct sl_subcompositor;
- struct sl_aura_shell;
- struct sl_viewporter;
-@@ -99,7 +99,7 @@ struct sl_context {
- struct sl_shm* shm;
- struct sl_shell* shell;
- struct sl_data_device_manager* data_device_manager;
-- struct sl_xdg_shell* xdg_shell;
-+ struct sl_xdg_wm_base* xdg_wm_base;
- struct sl_aura_shell* aura_shell;
- struct sl_viewporter* viewporter;
- struct sl_linux_dmabuf* linux_dmabuf;
-@@ -373,11 +373,12 @@ struct sl_viewporter {
- struct wp_viewporter* internal;
- };
-
--struct sl_xdg_shell {
-+struct sl_xdg_wm_base {
+@@ -411,7 +411,7 @@ struct sl_xdg_shell {
struct sl_context* ctx;
uint32_t id;
-+ uint32_t version;
struct sl_global* host_global;
- struct zxdg_shell_v6* internal;
+ struct xdg_wm_base* internal;
};

struct sl_aura_shell {
-@@ -476,9 +477,9 @@ struct sl_window {
+@@ -511,9 +511,9 @@ struct sl_window {
int max_height;
struct sl_config next_config;
struct sl_config pending_config;
@@ -1734,15 +1832,6 @@ index b851b5c8d..7e6daf773 100644
struct zaura_surface* aura_surface;
struct wl_list link;
};
-@@ -522,7 +523,7 @@ struct sl_global* sl_data_device_manager_global_create(struct sl_context* ctx);
-
- struct sl_global* sl_viewporter_global_create(struct sl_context* ctx);
-
--struct sl_global* sl_xdg_shell_global_create(struct sl_context* ctx);
-+struct sl_global* sl_xdg_wm_base_global_create(struct sl_context* ctx);
-
- struct sl_global* sl_gtk_shell_global_create(struct sl_context* ctx);
-
--
-2.26.2
+2.30.0

diff --git a/pkgs/os-specific/linux/chromium-os/sommelier/0006-sommelier-make-building-demos-optional.patch b/pkgs/os-specific/linux/chromium-os/sommelier/0006-sommelier-make-building-demos-optional.patch
deleted file mode 100644
index ecc876e4bfb..00000000000
--- a/pkgs/os-specific/linux/chromium-os/sommelier/0006-sommelier-make-building-demos-optional.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 6a4ccbcded19df9ec42b865218ac744e6b35d505 Mon Sep 17 00:00:00 2001
-From: Alyssa Ross <hi@alyssa.is>
-Date: Wed, 15 Jan 2020 21:36:43 +0000
-Subject: [PATCH 6/6] sommelier: make building demos optional
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-pkg-config was checked at GN evaluation time for libbrillo and
-libchrome, meaning that there was no way to build sommelier without
-them, even though they were only required for the demos, not for
-sommelier itself.
-
-Making the demo optional saves having to libbrillo and libchrome for
-the common case of building just sommelier, which themselves have lots
-of unusual dependencies.
-
-Thanks-to: Tomasz Śniatowski <tsniatowski@vewd.com>
----
- vm_tools/sommelier/BUILD.gn | 54 ++++++++++++++++++++++---------------
- 1 file changed, 32 insertions(+), 22 deletions(-)
-
-diff --git a/vm_tools/sommelier/BUILD.gn b/vm_tools/sommelier/BUILD.gn
-index 4330560a1..cbb752745 100644
---- a/vm_tools/sommelier/BUILD.gn
-+++ b/vm_tools/sommelier/BUILD.gn
-@@ -4,12 +4,20 @@
-
- import("wayland_protocol.gni")
-
-+declare_args() {
-+ use_demos = true
-+}
-+
- group("all") {
- deps = [
- ":sommelier",
-- ":wayland_demo",
-- ":x11_demo",
- ]
-+ if (use_demos) {
-+ deps += [
-+ ":wayland_demo",
-+ ":x11_demo",
-+ ]
-+ }
- }
-
- if (!defined(peer_cmd_prefix)) {
-@@ -123,25 +131,27 @@ executable("sommelier") {
- ]
- }
-
--executable("wayland_demo") {
-- pkg_deps = [
-- "libbrillo",
-- "libchrome-${libbase_ver}",
-- "wayland-client",
-- ]
-- libs = [ "wayland-client" ]
-- sources = [
-- "demos/wayland_demo.cc",
-- ]
--}
-+if (use_demos) {
-+ executable("wayland_demo") {
-+ pkg_deps = [
-+ "libbrillo",
-+ "libchrome-${libbase_ver}",
-+ "wayland-client",
-+ ]
-+ libs = [ "wayland-client" ]
-+ sources = [
-+ "demos/wayland_demo.cc",
-+ ]
-+ }
-
--executable("x11_demo") {
-- pkg_deps = [
-- "libbrillo",
-- "libchrome-${libbase_ver}",
-- ]
-- libs = [ "X11" ]
-- sources = [
-- "demos/x11_demo.cc",
-- ]
-+ executable("x11_demo") {
-+ pkg_deps = [
-+ "libbrillo",
-+ "libchrome-${libbase_ver}",
-+ ]
-+ libs = [ "X11" ]
-+ sources = [
-+ "demos/x11_demo.cc",
-+ ]
-+ }
- }
---
-2.26.2
-
diff --git a/pkgs/os-specific/linux/chromium-os/sommelier/default.nix b/pkgs/os-specific/linux/chromium-os/sommelier/default.nix
index 9bf2777bfd7..c995689c4f5 100644
--- a/pkgs/os-specific/linux/chromium-os/sommelier/default.nix
+++ b/pkgs/os-specific/linux/chromium-os/sommelier/default.nix
@@ -7,9 +7,8 @@ common-mk {
platformSubdir = "vm_tools/sommelier";

platform2Patches = [
- ./0004-sommelier-don-t-leak-source-absolute-paths.patch
- ./0005-sommelier-use-stable-xdg-shell-protocol.patch
- ./0006-sommelier-make-building-demos-optional.patch
+ ./0003-sommelier-don-t-leak-source-absolute-paths.patch
+ ./0004-Revert-Revert-vm_tools-sommelier-Switch-to-the-stabl.patch
];

buildInputs = [
--
2.31.1