1 From 98de96755da14f4cabf2447ce88a01cd3cdca770 Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Sun, 2 Jul 2023 11:11:07 +0200
4 Subject: [PATCH 05/33] [agl] Start using agl-shell version 4
6 Signed-off-by: Roger Zanoni <rzanoni@igalia.com>
8 ui/aura/agl/window_tree_host_agl.h | 1 +
9 ui/aura/agl/window_tree_host_platform_agl.cc | 4 +
10 ui/aura/agl/window_tree_host_platform_agl.h | 1 +
11 .../extensions/agl/host/agl_shell_wrapper.cc | 9 +
12 .../extensions/agl/host/agl_shell_wrapper.h | 1 +
13 .../agl/host/wayland_extensions_agl_impl.cc | 2 +-
14 .../extensions/agl/host/wayland_window_agl.cc | 10 +
15 .../extensions/agl/host/wayland_window_agl.h | 1 +
16 .../extensions/agl/protocol/agl-shell.xml | 185 +++++++++++++++++-
17 ui/platform_window/agl/platform_window_agl.h | 1 +
18 10 files changed, 213 insertions(+), 2 deletions(-)
20 diff --git a/ui/aura/agl/window_tree_host_agl.h b/ui/aura/agl/window_tree_host_agl.h
21 index b9aa451c8332e..c5213f75e623e 100644
22 --- a/ui/aura/agl/window_tree_host_agl.h
23 +++ b/ui/aura/agl/window_tree_host_agl.h
24 @@ -36,6 +36,7 @@ class AURA_EXPORT WindowTreeHostAgl {
25 virtual void SetAglBackground() {}
26 virtual void SetAglPanel(uint32_t edge) {}
27 virtual bool IsSurfaceConfigured() const { return false; }
28 + virtual void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {}
32 diff --git a/ui/aura/agl/window_tree_host_platform_agl.cc b/ui/aura/agl/window_tree_host_platform_agl.cc
33 index 67190e1da6973..b9bae3f3b9bdc 100644
34 --- a/ui/aura/agl/window_tree_host_platform_agl.cc
35 +++ b/ui/aura/agl/window_tree_host_platform_agl.cc
36 @@ -51,4 +51,8 @@ bool WindowTreeHostPlatformAgl::IsSurfaceConfigured() const {
37 return window_tree_host_platform_->platform_window()->IsSurfaceConfigured();
40 +void WindowTreeHostPlatformAgl::SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
41 + window_tree_host_platform_->platform_window()->SetupActivationArea(x, y, width, height);
45 diff --git a/ui/aura/agl/window_tree_host_platform_agl.h b/ui/aura/agl/window_tree_host_platform_agl.h
46 index e5a29fa1bfca3..30e160736e327 100644
47 --- a/ui/aura/agl/window_tree_host_platform_agl.h
48 +++ b/ui/aura/agl/window_tree_host_platform_agl.h
49 @@ -42,6 +42,7 @@ class AURA_EXPORT WindowTreeHostPlatformAgl : public aura::WindowTreeHost {
50 void SetAglBackground() override;
51 void SetAglPanel(uint32_t edge) override;
52 bool IsSurfaceConfigured() const override;
53 + void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override;
56 aura::WindowTreeHostPlatform* window_tree_host_platform_;
57 diff --git a/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.cc b/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.cc
58 index c74fa5d9cd221..0d5d79c4738df 100644
59 --- a/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.cc
60 +++ b/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.cc
61 @@ -110,4 +110,13 @@ bool AglShellWrapper::WaitUntilBoundOk() {
65 +void AglShellWrapper::SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
66 +#ifdef AGL_SHELL_SET_ACTIVATE_REGION_SINCE_VERSION
68 + connection_->wayland_output_manager()->GetPrimaryOutput()->get_output();
69 + agl_shell_set_activate_region(agl_shell_.get(), output, x, y,
75 diff --git a/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.h b/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.h
76 index 2ab765883057e..1c2074e1b4306 100644
77 --- a/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.h
78 +++ b/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.h
79 @@ -39,6 +39,7 @@ class AglShellWrapper {
80 void SetAglPanel(WaylandWindow* window, uint32_t edge);
81 void SetAglBackground(WaylandWindow* window);
83 + void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
84 bool WaitUntilBoundOk();
86 static void AglShellBoundOk(void* data, struct agl_shell*);
87 diff --git a/ui/ozone/platform/wayland/extensions/agl/host/wayland_extensions_agl_impl.cc b/ui/ozone/platform/wayland/extensions/agl/host/wayland_extensions_agl_impl.cc
88 index 075b3010ea8a1..8f9d938cdd1f6 100644
89 --- a/ui/ozone/platform/wayland/extensions/agl/host/wayland_extensions_agl_impl.cc
90 +++ b/ui/ozone/platform/wayland/extensions/agl/host/wayland_extensions_agl_impl.cc
91 @@ -32,7 +32,7 @@ namespace ui {
94 constexpr uint32_t kMinAglShellExtensionVersion = 1;
95 -constexpr uint32_t kMaxAglShellExtensionVersion = 3;
96 +constexpr uint32_t kMaxAglShellExtensionVersion = 4;
100 diff --git a/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.cc b/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.cc
101 index 97b21ae537658..f92406d455de1 100644
102 --- a/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.cc
103 +++ b/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.cc
104 @@ -83,4 +83,14 @@ void WaylandWindowAgl::SetAglPanel(uint32_t edge) {
105 connection()->ScheduleFlush();
108 +void WaylandWindowAgl::SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
109 + if (!agl_extensions_->GetAglShell()) {
110 + LOG(ERROR) << "Agl shell wrapper is not created";
114 + agl_extensions_->GetAglShell()->SetupActivationArea(x, y, width, height);
115 + connection()->ScheduleFlush();
119 diff --git a/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.h b/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.h
120 index b2a922604c001..d21d2d9387215 100644
121 --- a/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.h
122 +++ b/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.h
123 @@ -39,6 +39,7 @@ class WaylandWindowAgl : public WaylandToplevelWindow {
124 void SetAglReady() override;
125 void SetAglBackground() override;
126 void SetAglPanel(uint32_t edge) override;
127 + void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override;
130 WaylandExtensionsAgl* agl_extensions_;
131 diff --git a/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml b/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml
132 index ad5553d61f189..e010a80808c69 100644
133 --- a/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml
134 +++ b/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml
136 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
137 DEALINGS IN THE SOFTWARE.
139 - <interface name="agl_shell" version="3">
140 + <interface name="agl_shell" version="8">
141 <description summary="user interface for Automotive Grade Linux platform">
142 Starting with version 2 of the protocol, the client is required to wait
143 for the 'bound_ok' or 'bound_fail' events in order to proceed further.
144 @@ -174,6 +174,189 @@
145 <arg name="state" type="uint" enum="app_state"/>
148 + <request name="set_activate_region" since="4">
149 + <description summary="sets a specific region to activate">
150 + A hint for the compositor to use a custom area, rather than
151 + inferring the activation area. If any panels are used
152 + the compositor computes the activation area by subtracting the
153 + panels geometry area. If no panels are used then the entire output
154 + is being used. This request changes that as to hint the compositor
155 + to use the supplied rectangle and ignore any potential panels
156 + that might been set-up previously.
158 + In order for this request to take effect it will need to happen
159 + before the 'ready' request in order for the compositor to make use of it.
160 + Note that any 'set_panel' request be will not be honored, if this request
163 + The x and y coordinates use the top-left corner as the origin. The
164 + rectangle area shouldn't exceed the output area, while an area smaller
165 + than the output, would basically result in showing up the background
168 + <arg name="output" type="object" interface="wl_output"/>
169 + <arg name="x" type="int" summary="x position of rectangle"/>
170 + <arg name="y" type="int" summary="y position of rectangle"/>
171 + <arg name="width" type="int" summary="width of rectangle"/>
172 + <arg name="height" type="int" summary="height of rectangle"/>
175 + <request name="deactivate_app" since="5">
176 + <description summary="de-activate/hide window identified by app_id">
177 + Ask the compositor to hide the toplevel window for window
178 + management purposes. Depending on the window role, this request
179 + will either display the previously active window (or the background
180 + in case there's no previously active surface) or temporarily (or
181 + until a 'activate_app' is called upon) hide the surface.
183 + All the surfaces are identifiable by using the app_id, and no actions
184 + are taken in case the app_id is not/was not present.
186 + See xdg_toplevel.set_app_id from the xdg-shell protocol for a
187 + description of app_id.
189 + <arg name="app_id" type="string"/>
192 + <request name="set_app_float" since="6">
193 + <description summary="set the window identified by app_id as float">
194 + Makes the application identified by app_id as floating. If the
195 + application's window is already mapped, in a maximized, normal state,
196 + it would transition to the float state.
198 + For applications that want to modify their own state, this request
199 + must be done before the initial surface commit in order to take effect.
201 + If the application is already in floating state, this request wouldn't
204 + There's no persistence of this request, once the application terminated
205 + you'll to issue this request again for that particular app_id.
207 + The x, and y values would be initial position of the window where the
208 + window surface will be placed.
210 + See xdg_toplevel.set_app_id from the xdg-shell protocol for a
211 + description of app_id.
213 + <arg name="app_id" type="string"/>
214 + <arg name="x" type="int" summary="x position"/>
215 + <arg name="y" type="int" summary="y position"/>
218 + <request name="set_app_normal" since="6">
219 + <description summary="set the window identified by app_id as normally started">
220 + Returns the application identified by app_id as it was in the normal state.
221 + This is useful to come back from other states to the maximized state, the
222 + normal state applications are started.
224 + <arg name="app_id" type="string"/>
227 + <request name="set_app_fullscreen" since="7">
228 + <description summary="">
229 + Makes the application identified by app_id as fullscreen. If the
230 + application's window is already mapped, in a maximized, normal state,
231 + it would transition to the fullscreen state.
233 + For applications that want to modify their own state, this request
234 + must be done before the initial surface commit in order to take effect.
236 + If the application is already in fullscreen state, this request wouldn't
239 + There's no persistence of this request, once the application terminated
240 + you'll to issue this request again for that particular app_id.
242 + See xdg_toplevel.set_app_id from the xdg-shell protocol for a
243 + description of app_id.
245 + <arg name="app_id" type="string"/>
248 + <request name="set_app_output" since="8">
249 + <description summary="Assign an application to a particular output">
250 + This would allow the compositor to place an application on a particular
251 + output, if that output is indeed available. This can happen before
252 + application is started which would make the application start on that
253 + particular output. If the application is already started it would
254 + move the application to that output.
256 + There's no persistence of this request, once the application terminated
257 + you'll need to issue this request again for that particular app_id.
259 + See xdg_toplevel.set_app_id from the xdg-shell protocol for a
260 + description of app_id.
262 + <arg name="app_id" type="string"/>
263 + <arg name="output" type="object" interface="wl_output"/>
266 + <event name="app_on_output" since="8">
267 + <description summary="Event sent as a reponse to set_app_output">
268 + Clients can use this event to be notified when an application
269 + wants to be displayed on a certain output. This event is sent in
270 + response to the set_app_output request.
272 + See xdg_toplevel.set_app_id from the xdg-shell protocol for a
273 + description of app_id.
275 + <arg name="app_id" type="string"/>
276 + <arg name="output_name" type="string"/>
280 + <interface name="agl_shell_ext" version="1">
281 + <description summary="extended user interface for Automotive Grade Linux platform">
282 + This interface allows another client bind to the agl_shell interface,
283 + while there's another shell client already present.
285 + The client should first bind to this interface and then inform the
286 + compositor with the 'doas_shell_client' request and it wants to bind to
287 + the agl_shell interface. The client is still expected, if using a new
288 + version of the agl_shell interface, to wait for the 'bound_ok' and
289 + 'bound_fail' events before issueing any other requests/events.
291 + Note that this interface has its limitations, and the compositor would
292 + still refuse the act for 'set_panel' or 'set_background' requests
293 + of the agl_shell interface if there's already a client that used them.
295 + Any other requests or events should be delievered and handled as it would
296 + a client bound to the agl_shell interface.
299 + <enum name="doas_shell_client_status">
300 + <entry name="success" value="0"/>
301 + <entry name="failed" value="1"/>
304 + <request name="destroy" type="destructor">
305 + <description summary="destroys the factory object">
306 + Call the destructor once you're ready with agl_shell_ext interface.
307 + This would reset the state and would make any requests made
308 + on the agl_shell interface be terminated. The client would need
309 + to bind again the agl_shell_ext and issue a 'doas_shell_client'
314 + <request name="doas_shell_client">
315 + <description summary="Informs the compositor it wants to bind to the
316 + agl_shell interface">
317 + Prior to binding to agl_shell interface, this request would inform
318 + the compositor that it wants to gain access the agl_shell interface.
319 + The client is expected to wait for 'doas_shell_client_done' event and
320 + check for a successful status before going further with binding to
321 + the agl_shell interface.
325 + <event name="doas_done">
326 + <description summary="event sent as a reply to doas_shell_client">
327 + The client should check the status event to verify that the
328 + compositor was able to handle the request.
330 + <arg name="status" type="uint" enum="doas_shell_client_status"/>
334 diff --git a/ui/platform_window/agl/platform_window_agl.h b/ui/platform_window/agl/platform_window_agl.h
335 index cab1f42272772..b1a6150fff950 100644
336 --- a/ui/platform_window/agl/platform_window_agl.h
337 +++ b/ui/platform_window/agl/platform_window_agl.h
338 @@ -30,6 +30,7 @@ class PlatformWindowAgl {
339 virtual void SetAglBackground() {}
340 virtual void SetAglPanel(uint32_t edge) {}
341 virtual bool IsSurfaceConfigured() { return false; }
342 + virtual void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {}