Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
From 7ba5377004f384304ae3ae199a7bde1d60248e4e Mon Sep 17 00:00:00 2001
From: Ray Smith <rsmith@brightsign.biz>
Date: Tue, 23 Dec 2025 19:46:23 +0000
Subject: [PATCH] os-20183: move z-order management to the compositor

Z-order is now managed in the compositor so that HTML and non-HTML
graphics widgets can be interspersed.
---
third_party/wayland-protocols/BUILD.gn | 2 +-
.../bs-z-order/bs-z-order-unstable-v1.xml | 14 ---------
.../bs-z-order/bs-z-order-unstable-v2.xml | 31 +++++++++++++++++++
.../platform/wayland/common/wayland_object.cc | 2 +-
.../platform/wayland/common/wayland_object.h | 4 +--
.../wayland/host/wayland_connection.cc | 12 +++----
.../wayland/host/wayland_connection.h | 4 +--
.../wayland/host/xdg_toplevel_wrapper_impl.cc | 19 ++++++++++--
8 files changed, 60 insertions(+), 28 deletions(-)
delete mode 100644 third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v1.xml
create mode 100644 third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v2.xml

diff --git a/third_party/wayland-protocols/BUILD.gn b/third_party/wayland-protocols/BUILD.gn
index c59c5a182c..3bbf95ba5b 100644
--- a/third_party/wayland-protocols/BUILD.gn
+++ b/third_party/wayland-protocols/BUILD.gn
@@ -12,7 +12,7 @@ wayland_protocol("alpha_compositing_protocol") {
}

wayland_protocol("bs_z_order_protocol") {
- sources = [ "unstable/bs-z-order/bs-z-order-unstable-v1.xml" ]
+ sources = [ "unstable/bs-z-order/bs-z-order-unstable-v2.xml" ]
}

wayland_protocol("content_type_protocol") {
diff --git a/third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v1.xml b/third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v1.xml
deleted file mode 100644
index da7ae7a6e2..0000000000
--- a/third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v1.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<protocol name="bs_z_order">
-
- <interface name="bs_z_order_v1" version="1">
- <request name="set_z_index">
- <arg name="surface" type="object" interface="wl_surface" />
- <arg name="z_index" type="int" />
- </request>
- <request name="set_background_color">
- <arg name="output" type="object" interface="wl_output" />
- <arg name="background_color" type="uint" />
- </request>
- </interface>
-
-</protocol>
diff --git a/third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v2.xml b/third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v2.xml
new file mode 100644
index 0000000000..f961a47c67
--- /dev/null
+++ b/third_party/wayland-protocols/unstable/bs-z-order/bs-z-order-unstable-v2.xml
@@ -0,0 +1,31 @@
+<protocol name="bs_z_order">
+
+ <interface name="bs_z_order_v2" version="1">
+ <enum name="role">
+ <entry name="none" value="0" />
+ <entry name="graphics" value="1" />
+ <entry name="video" value="2" />
+ <entry name="ticker" value="3" />
+ <entry name="virtual_keyboard" value="4" />
+ </enum>
+
+ <request name="set_role">
+ <arg name="surface" type="object" interface="wl_surface" />
+ <arg name="role" type="uint" enum="role" />
+ </request>
+
+ <request name="raise">
+ <arg name="surface" type="object" interface="wl_surface" />
+ </request>
+
+ <request name="lower">
+ <arg name="surface" type="object" interface="wl_surface" />
+ </request>
+
+ <request name="set_z_index">
+ <arg name="surface" type="object" interface="wl_surface" />
+ <arg name="z_index" type="int" />
+ </request>
+ </interface>
+
+</protocol>
diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc
index cf291424ff..e2703805cd 100644
--- a/ui/ozone/platform/wayland/common/wayland_object.cc
+++ b/ui/ozone/platform/wayland/common/wayland_object.cc
@@ -190,7 +190,7 @@ void (*ObjectTraits<wl_proxy>::deleter)(void*) = &wl_proxy_wrapper_destroy;
// For convenience, keep aphabetical order in this list.
IMPLEMENT_WAYLAND_OBJECT_TRAITS(augmented_surface)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(augmented_sub_surface)
-IMPLEMENT_WAYLAND_OBJECT_TRAITS(bs_z_order_v1)
+IMPLEMENT_WAYLAND_OBJECT_TRAITS(bs_z_order_v2)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(gtk_primary_selection_device)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(gtk_primary_selection_device_manager)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(gtk_primary_selection_offer)
diff --git a/ui/ozone/platform/wayland/common/wayland_object.h b/ui/ozone/platform/wayland/common/wayland_object.h
index 9f2c034da7..fbbd0a8c8a 100644
--- a/ui/ozone/platform/wayland/common/wayland_object.h
+++ b/ui/ozone/platform/wayland/common/wayland_object.h
@@ -6,7 +6,7 @@
#define UI_OZONE_PLATFORM_WAYLAND_COMMON_WAYLAND_OBJECT_H_

#include <memory>
-#include <bs-z-order-unstable-v1-client-protocol.h>
+#include <bs-z-order-unstable-v2-client-protocol.h>

#include "base/check.h"
#include "ui/ozone/platform/wayland/common/wayland.h"
@@ -106,7 +106,7 @@ bool CanBind(const std::string& interface,
// For convenience, keep aphabetical order in this list.
DECLARE_WAYLAND_OBJECT_TRAITS(augmented_surface)
DECLARE_WAYLAND_OBJECT_TRAITS(augmented_sub_surface)
-DECLARE_WAYLAND_OBJECT_TRAITS(bs_z_order_v1)
+DECLARE_WAYLAND_OBJECT_TRAITS(bs_z_order_v2)
DECLARE_WAYLAND_OBJECT_TRAITS(gtk_primary_selection_device)
DECLARE_WAYLAND_OBJECT_TRAITS(gtk_primary_selection_device_manager)
DECLARE_WAYLAND_OBJECT_TRAITS(gtk_primary_selection_offer)
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc
index e444e8d810..e0e77580fc 100644
--- a/ui/ozone/platform/wayland/host/wayland_connection.cc
+++ b/ui/ozone/platform/wayland/host/wayland_connection.cc
@@ -8,7 +8,7 @@
#include <extended-drag-unstable-v1-client-protocol.h>
#include <presentation-time-client-protocol.h>
#include <xdg-shell-client-protocol.h>
-#include <bs-z-order-unstable-v1-client-protocol.h>
+#include <bs-z-order-unstable-v2-client-protocol.h>

#include <algorithm>
#include <cstdint>
@@ -552,12 +552,12 @@ void WaylandConnection::HandleGlobal(void* data,
auto factory_it = global_object_factories_.find(interface);
if (factory_it != global_object_factories_.end()) {
(*factory_it->second)(this, registry, name, interface, version);
- } else if (!connection->bs_z_order_v1_ &&
- strcmp(interface, "bs_z_order_v1") == 0) {
- connection->bs_z_order_v1_ = wl::Bind<bs_z_order_v1>(
+ } else if (!connection->bs_z_order_v2_ &&
+ strcmp(interface, "bs_z_order_v2") == 0) {
+ connection->bs_z_order_v2_ = wl::Bind<bs_z_order_v2>(
registry, name, std::min(version, kMaxBsZOrderVersion));
- if (!connection->bs_z_order_v1_) {
- LOG(ERROR) << "Failed to bind to bs_z_order_v1 global";
+ if (!connection->bs_z_order_v2_) {
+ LOG(ERROR) << "Failed to bind to bs_z_order_v2 global";
return;
}
} else if (!compositor_ && strcmp(interface, "wl_compositor") == 0) {
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h
index 2cb8078dba..44aae57cca 100644
--- a/ui/ozone/platform/wayland/host/wayland_connection.h
+++ b/ui/ozone/platform/wayland/host/wayland_connection.h
@@ -110,7 +110,7 @@ class WaylandConnection {
// error. Called by WaylandEventWatcher.
void SetShutdownCb(base::OnceCallback<void()> shutdown_cb);

- bs_z_order_v1* bs_z_order() const { return bs_z_order_v1_.get(); }
+ bs_z_order_v2* bs_z_order() const { return bs_z_order_v2_.get(); }

// A correct display must be chosen when creating objects or calling
// roundrips. That is, all the methods that deal with polling, pulling event
@@ -433,7 +433,7 @@ class WaylandConnection {
base::flat_map<std::string, wl::GlobalObjectFactory> global_object_factories_;

uint32_t compositor_version_ = 0;
- wl::Object<bs_z_order_v1> bs_z_order_v1_;
+ wl::Object<bs_z_order_v2> bs_z_order_v2_;
wl::Object<wl_display> display_;
wl::Object<wl_proxy> wrapped_display_;
wl::Object<wl_event_queue> event_queue_;
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
index dd66fd2e2a..48e4663955 100644
--- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
+++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
@@ -6,7 +6,7 @@

#include <aura-shell-client-protocol.h>
#include <xdg-decoration-unstable-v1-client-protocol.h>
-#include <bs-z-order-unstable-v1-client-protocol.h>
+#include <bs-z-order-unstable-v2-client-protocol.h>

#include "base/logging.h"
#include "base/notreached.h"
@@ -580,7 +580,22 @@ void XDGToplevelWrapperImpl::SetZOrder(ZOrderLevel z_order) {
}
else if (!aura_toplevel_ && connection_->bs_z_order()) {
// The z-index we get if we are using xdg on a BS device is an absolute value.
- bs_z_order_v1_set_z_index(connection_->bs_z_order(), wayland_window_->root_surface()->surface(), (int)z_order);
+ switch (z_order) {
+ case (ZOrderLevel)566:
+ bs_z_order_v2_raise(connection_->bs_z_order(), wayland_window_->root_surface()->surface());
+ break;
+ case (ZOrderLevel)565:
+ bs_z_order_v2_lower(connection_->bs_z_order(), wayland_window_->root_surface()->surface());
+ break;
+ case (ZOrderLevel)567:
+ bs_z_order_v2_set_role(connection_->bs_z_order(), wayland_window_->root_surface()->surface(), BS_Z_ORDER_V2_ROLE_VIRTUAL_KEYBOARD);
+ break;
+ case (ZOrderLevel)568:
+ bs_z_order_v2_set_role(connection_->bs_z_order(), wayland_window_->root_surface()->surface(), BS_Z_ORDER_V2_ROLE_GRAPHICS);
+ break;
+ default:
+ abort();
+ }
}
}

--
2.30.2