diff --git a/meta-chromium/recipes-browser/chromium/chromium-gn.inc b/meta-chromium/recipes-browser/chromium/chromium-gn.inc index 8edbf55f..52431093 100644 --- a/meta-chromium/recipes-browser/chromium/chromium-gn.inc +++ b/meta-chromium/recipes-browser/chromium/chromium-gn.inc @@ -31,6 +31,7 @@ SRC_URI += " \ file://0024-Backport-Fix-erroneous-SupportsOstreamOperator-int-i.patch \ file://0025-Backport-Do-not-use-std-monospace-for-absl-variant.patch \ file://0026-Backport-std-string-ends_with-is-C-20.-Use-base-Ends.patch \ + file://0027-Track-Wayland-seats-other-than-primary.patch \ " SRC_URI:append:libc-musl = "\ diff --git a/meta-chromium/recipes-browser/chromium/files/0027-Track-Wayland-seats-other-than-primary.patch b/meta-chromium/recipes-browser/chromium/files/0027-Track-Wayland-seats-other-than-primary.patch new file mode 100644 index 00000000..a656d87a --- /dev/null +++ b/meta-chromium/recipes-browser/chromium/files/0027-Track-Wayland-seats-other-than-primary.patch @@ -0,0 +1,87 @@ +From d2f5a74f9d9afc5bbbb550570b972fb5784e0b09 Mon Sep 17 00:00:00 2001 +From: Lachlan Frawley +Date: Thu, 22 Jun 2023 22:38:29 +0000 +Subject: [PATCH] Track Wayland seats other than primary + +--- + .../wayland/host/wayland_connection.cc | 7 ++++++ + .../wayland/host/wayland_connection.h | 1 + + .../platform/wayland/host/wayland_seat.cc | 24 ++++++++++++++----- + 3 files changed, 26 insertions(+), 6 deletions(-) + +diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc +index f04dbf016..01005d419 100644 +--- a/ui/ozone/platform/wayland/host/wayland_connection.cc ++++ b/ui/ozone/platform/wayland/host/wayland_connection.cc +@@ -609,6 +609,13 @@ void WaylandConnection::GlobalRemove(void* data, + wl_registry* registry, + uint32_t name) { + auto* connection = static_cast(data); ++ ++ // We track the names of seats locally ++ auto extra_seat_it = connection->extra_seats_.find(name); ++ if(extra_seat_it != connection->extra_seats_.end()) { ++ connection->extra_seats_.erase(extra_seat_it); ++ } ++ + // The Wayland protocol distinguishes global objects by unique numeric names, + // which the WaylandOutputManager uses as unique output ids. But, it is only + // possible to figure out, what global object is going to be removed on the +diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h +index c0197481b..e48f995ae 100644 +--- a/ui/ozone/platform/wayland/host/wayland_connection.h ++++ b/ui/ozone/platform/wayland/host/wayland_connection.h +@@ -429,6 +429,7 @@ class WaylandConnection { + zwp_relative_pointer_manager_; + std::unique_ptr zwp_pointer_gestures_; + std::unique_ptr seat_; ++ base::flat_map> extra_seats_; + std::unique_ptr buffer_manager_host_; + std::unique_ptr xdg_activation_; + std::unique_ptr xdg_foreign_; +diff --git a/ui/ozone/platform/wayland/host/wayland_seat.cc b/ui/ozone/platform/wayland/host/wayland_seat.cc +index 061e0560d..08b4b1380 100644 +--- a/ui/ozone/platform/wayland/host/wayland_seat.cc ++++ b/ui/ozone/platform/wayland/host/wayland_seat.cc +@@ -33,8 +33,9 @@ void WaylandSeat::Instantiate(WaylandConnection* connection, + CHECK_EQ(interface, kInterfaceName) << "Expected \"" << kInterfaceName + << "\" but got \"" << interface << "\""; + +- if (connection->seat_ || +- !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) { ++ // Only check if we can bind the interface ++ if(!wl::CanBind(interface, version, kMinVersion, kMaxVersion)) { ++ LOG(ERROR) << "Cannot bind wl_seat"; + return; + } + +@@ -44,11 +45,22 @@ void WaylandSeat::Instantiate(WaylandConnection* connection, + LOG(ERROR) << "Failed to bind to wl_seat global"; + return; + } +- connection->seat_ = std::make_unique(seat.release(), connection); + +- // The seat is one of objects needed for data exchange. Notify the connection +- // so it might set up the rest if all other parts are in place. +- connection->CreateDataObjectsIfReady(); ++ // If we have no "primary" seat, then assume whatever seat we get first is ++ // meant to be the primary seat ++ if(!connection->seat_) { ++ connection->seat_ = std::make_unique(seat.release(), connection); ++ ++ // The seat is one of objects needed for data exchange. Notify the connection ++ // so it might set up the rest if all other parts are in place. ++ connection->CreateDataObjectsIfReady(); ++ } else { ++ if(connection->extra_seats_.find(name) != connection->extra_seats_.end()) { ++ LOG(ERROR) << "Seat with name already exists"; ++ return; ++ } ++ connection->extra_seats_.emplace(name, std::make_unique(seat.release(), connection)); ++ } + } + + WaylandSeat::WaylandSeat(wl_seat* seat, WaylandConnection* connection) +-- +2.34.1 +