Skip to content

Commit a0c7258

Browse files
Added patch that lets chromium-ozone-wayland track additional Wayland seats, i.e. in the case of VNC/RDP
Tested with desktop-shell for main compositor, and fullscreen-shell for VNC compositor.
1 parent b279a4d commit a0c7258

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

meta-chromium/recipes-browser/chromium/chromium-gn.inc

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ SRC_URI += " \
3131
file://0024-Backport-Fix-erroneous-SupportsOstreamOperator-int-i.patch \
3232
file://0025-Backport-Do-not-use-std-monospace-for-absl-variant.patch \
3333
file://0026-Backport-std-string-ends_with-is-C-20.-Use-base-Ends.patch \
34+
file://0027-Track-Wayland-seats-other-than-primary.patch \
3435
"
3536

3637
SRC_URI:append:libc-musl = "\
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
From d2f5a74f9d9afc5bbbb550570b972fb5784e0b09 Mon Sep 17 00:00:00 2001
2+
From: Lachlan Frawley <[email protected]>
3+
Date: Thu, 22 Jun 2023 22:38:29 +0000
4+
Subject: [PATCH] Track Wayland seats other than primary
5+
6+
---
7+
.../wayland/host/wayland_connection.cc | 7 ++++++
8+
.../wayland/host/wayland_connection.h | 1 +
9+
.../platform/wayland/host/wayland_seat.cc | 24 ++++++++++++++-----
10+
3 files changed, 26 insertions(+), 6 deletions(-)
11+
12+
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc
13+
index f04dbf016..01005d419 100644
14+
--- a/ui/ozone/platform/wayland/host/wayland_connection.cc
15+
+++ b/ui/ozone/platform/wayland/host/wayland_connection.cc
16+
@@ -609,6 +609,13 @@ void WaylandConnection::GlobalRemove(void* data,
17+
wl_registry* registry,
18+
uint32_t name) {
19+
auto* connection = static_cast<WaylandConnection*>(data);
20+
+
21+
+ // We track the names of seats locally
22+
+ auto extra_seat_it = connection->extra_seats_.find(name);
23+
+ if(extra_seat_it != connection->extra_seats_.end()) {
24+
+ connection->extra_seats_.erase(extra_seat_it);
25+
+ }
26+
+
27+
// The Wayland protocol distinguishes global objects by unique numeric names,
28+
// which the WaylandOutputManager uses as unique output ids. But, it is only
29+
// possible to figure out, what global object is going to be removed on the
30+
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h
31+
index c0197481b..e48f995ae 100644
32+
--- a/ui/ozone/platform/wayland/host/wayland_connection.h
33+
+++ b/ui/ozone/platform/wayland/host/wayland_connection.h
34+
@@ -429,6 +429,7 @@ class WaylandConnection {
35+
zwp_relative_pointer_manager_;
36+
std::unique_ptr<WaylandZwpPointerGestures> zwp_pointer_gestures_;
37+
std::unique_ptr<WaylandSeat> seat_;
38+
+ base::flat_map<uint32_t, std::unique_ptr<WaylandSeat>> extra_seats_;
39+
std::unique_ptr<WaylandBufferManagerHost> buffer_manager_host_;
40+
std::unique_ptr<XdgActivation> xdg_activation_;
41+
std::unique_ptr<XdgForeignWrapper> xdg_foreign_;
42+
diff --git a/ui/ozone/platform/wayland/host/wayland_seat.cc b/ui/ozone/platform/wayland/host/wayland_seat.cc
43+
index 061e0560d..08b4b1380 100644
44+
--- a/ui/ozone/platform/wayland/host/wayland_seat.cc
45+
+++ b/ui/ozone/platform/wayland/host/wayland_seat.cc
46+
@@ -33,8 +33,9 @@ void WaylandSeat::Instantiate(WaylandConnection* connection,
47+
CHECK_EQ(interface, kInterfaceName) << "Expected \"" << kInterfaceName
48+
<< "\" but got \"" << interface << "\"";
49+
50+
- if (connection->seat_ ||
51+
- !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) {
52+
+ // Only check if we can bind the interface
53+
+ if(!wl::CanBind(interface, version, kMinVersion, kMaxVersion)) {
54+
+ LOG(ERROR) << "Cannot bind wl_seat";
55+
return;
56+
}
57+
58+
@@ -44,11 +45,22 @@ void WaylandSeat::Instantiate(WaylandConnection* connection,
59+
LOG(ERROR) << "Failed to bind to wl_seat global";
60+
return;
61+
}
62+
- connection->seat_ = std::make_unique<WaylandSeat>(seat.release(), connection);
63+
64+
- // The seat is one of objects needed for data exchange. Notify the connection
65+
- // so it might set up the rest if all other parts are in place.
66+
- connection->CreateDataObjectsIfReady();
67+
+ // If we have no "primary" seat, then assume whatever seat we get first is
68+
+ // meant to be the primary seat
69+
+ if(!connection->seat_) {
70+
+ connection->seat_ = std::make_unique<WaylandSeat>(seat.release(), connection);
71+
+
72+
+ // The seat is one of objects needed for data exchange. Notify the connection
73+
+ // so it might set up the rest if all other parts are in place.
74+
+ connection->CreateDataObjectsIfReady();
75+
+ } else {
76+
+ if(connection->extra_seats_.find(name) != connection->extra_seats_.end()) {
77+
+ LOG(ERROR) << "Seat with name already exists";
78+
+ return;
79+
+ }
80+
+ connection->extra_seats_.emplace(name, std::make_unique<WaylandSeat>(seat.release(), connection));
81+
+ }
82+
}
83+
84+
WaylandSeat::WaylandSeat(wl_seat* seat, WaylandConnection* connection)
85+
--
86+
2.34.1
87+

0 commit comments

Comments
 (0)