From 87e8811a2fc95b57f958e2bdfe5f3e434ecbff1e Mon Sep 17 00:00:00 2001 From: Roger Zanoni Date: Sun, 2 Jul 2023 11:11:07 +0200 Subject: [PATCH 9/9] Start using agl-shell version 4 --- ui/aura/agl/window_tree_host_agl.h | 1 + ui/aura/agl/window_tree_host_platform_agl.cc | 4 + ui/aura/agl/window_tree_host_platform_agl.h | 1 + .../extensions/agl/host/agl_shell_wrapper.cc | 9 + .../extensions/agl/host/agl_shell_wrapper.h | 1 + .../agl/host/wayland_extensions_agl_impl.cc | 2 +- .../extensions/agl/host/wayland_window_agl.cc | 10 + .../extensions/agl/host/wayland_window_agl.h | 1 + .../extensions/agl/protocol/agl-shell.xml | 185 +++++++++++++++++- ui/platform_window/agl/platform_window_agl.h | 1 + 10 files changed, 213 insertions(+), 2 deletions(-) diff --git a/ui/aura/agl/window_tree_host_agl.h b/ui/aura/agl/window_tree_host_agl.h index b9aa451c8332e..c5213f75e623e 100644 --- a/ui/aura/agl/window_tree_host_agl.h +++ b/ui/aura/agl/window_tree_host_agl.h @@ -36,6 +36,7 @@ class AURA_EXPORT WindowTreeHostAgl { virtual void SetAglBackground() {} virtual void SetAglPanel(uint32_t edge) {} virtual bool IsSurfaceConfigured() const { return false; } + virtual void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {} }; } // namespace aura diff --git a/ui/aura/agl/window_tree_host_platform_agl.cc b/ui/aura/agl/window_tree_host_platform_agl.cc index 67190e1da6973..b9bae3f3b9bdc 100644 --- a/ui/aura/agl/window_tree_host_platform_agl.cc +++ b/ui/aura/agl/window_tree_host_platform_agl.cc @@ -51,4 +51,8 @@ bool WindowTreeHostPlatformAgl::IsSurfaceConfigured() const { return window_tree_host_platform_->platform_window()->IsSurfaceConfigured(); } +void WindowTreeHostPlatformAgl::SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) { + window_tree_host_platform_->platform_window()->SetupActivationArea(x, y, width, height); +} + } // namespace aura diff --git a/ui/aura/agl/window_tree_host_platform_agl.h b/ui/aura/agl/window_tree_host_platform_agl.h index e5a29fa1bfca3..30e160736e327 100644 --- a/ui/aura/agl/window_tree_host_platform_agl.h +++ b/ui/aura/agl/window_tree_host_platform_agl.h @@ -42,6 +42,7 @@ class AURA_EXPORT WindowTreeHostPlatformAgl : public aura::WindowTreeHost { void SetAglBackground() override; void SetAglPanel(uint32_t edge) override; bool IsSurfaceConfigured() const override; + void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override; private: aura::WindowTreeHostPlatform* window_tree_host_platform_; 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 index c74fa5d9cd221..0d5d79c4738df 100644 --- a/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.cc +++ b/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.cc @@ -110,4 +110,13 @@ bool AglShellWrapper::WaitUntilBoundOk() { return bound_ok_; } +void AglShellWrapper::SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) { +#ifdef AGL_SHELL_SET_ACTIVATE_REGION_SINCE_VERSION + wl_output* output = + connection_->wayland_output_manager()->GetPrimaryOutput()->get_output(); + agl_shell_set_activate_region(agl_shell_.get(), output, x, y, + width, height); +#endif +} + } // namespace ui 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 index 2ab765883057e..1c2074e1b4306 100644 --- a/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.h +++ b/ui/ozone/platform/wayland/extensions/agl/host/agl_shell_wrapper.h @@ -39,6 +39,7 @@ class AglShellWrapper { void SetAglPanel(WaylandWindow* window, uint32_t edge); void SetAglBackground(WaylandWindow* window); void SetAglReady(); + void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height); bool WaitUntilBoundOk(); static void AglShellBoundOk(void* data, struct agl_shell*); 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 index 075b3010ea8a1..8f9d938cdd1f6 100644 --- 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 @@ -32,7 +32,7 @@ namespace ui { namespace { constexpr uint32_t kMinAglShellExtensionVersion = 1; -constexpr uint32_t kMaxAglShellExtensionVersion = 3; +constexpr uint32_t kMaxAglShellExtensionVersion = 4; } // namespace 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 index 97b21ae537658..f92406d455de1 100644 --- a/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.cc +++ b/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.cc @@ -83,4 +83,14 @@ void WaylandWindowAgl::SetAglPanel(uint32_t edge) { connection()->ScheduleFlush(); } +void WaylandWindowAgl::SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) { + if (!agl_extensions_->GetAglShell()) { + LOG(ERROR) << "Agl shell wrapper is not created"; + return; + } + + agl_extensions_->GetAglShell()->SetupActivationArea(x, y, width, height); + connection()->ScheduleFlush(); +} + } // namespace ui 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 index b2a922604c001..d21d2d9387215 100644 --- a/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.h +++ b/ui/ozone/platform/wayland/extensions/agl/host/wayland_window_agl.h @@ -39,6 +39,7 @@ class WaylandWindowAgl : public WaylandToplevelWindow { void SetAglReady() override; void SetAglBackground() override; void SetAglPanel(uint32_t edge) override; + void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override; private: WaylandExtensionsAgl* agl_extensions_; diff --git a/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml b/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml index ad5553d61f189..e010a80808c69 100644 --- a/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml +++ b/ui/ozone/platform/wayland/extensions/agl/protocol/agl-shell.xml @@ -22,7 +22,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + Starting with version 2 of the protocol, the client is required to wait for the 'bound_ok' or 'bound_fail' events in order to proceed further. @@ -174,6 +174,189 @@ + + + A hint for the compositor to use a custom area, rather than + inferring the activation area. If any panels are used + the compositor computes the activation area by subtracting the + panels geometry area. If no panels are used then the entire output + is being used. This request changes that as to hint the compositor + to use the supplied rectangle and ignore any potential panels + that might been set-up previously. + In order for this request to take effect it will need to happen + before the 'ready' request in order for the compositor to make use of it. + Note that any 'set_panel' request be will not be honored, if this request + has been called. + + The x and y coordinates use the top-left corner as the origin. The + rectangle area shouldn't exceed the output area, while an area smaller + than the output, would basically result in showing up the background + surface. + + + + + + + + + + + Ask the compositor to hide the toplevel window for window + management purposes. Depending on the window role, this request + will either display the previously active window (or the background + in case there's no previously active surface) or temporarily (or + until a 'activate_app' is called upon) hide the surface. + + All the surfaces are identifiable by using the app_id, and no actions + are taken in case the app_id is not/was not present. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + + + + + + + Makes the application identified by app_id as floating. If the + application's window is already mapped, in a maximized, normal state, + it would transition to the float state. + + For applications that want to modify their own state, this request + must be done before the initial surface commit in order to take effect. + + If the application is already in floating state, this request wouldn't + do anything. + + There's no persistence of this request, once the application terminated + you'll to issue this request again for that particular app_id. + + The x, and y values would be initial position of the window where the + window surface will be placed. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + + + + + + + + + Returns the application identified by app_id as it was in the normal state. + This is useful to come back from other states to the maximized state, the + normal state applications are started. + + + + + + + Makes the application identified by app_id as fullscreen. If the + application's window is already mapped, in a maximized, normal state, + it would transition to the fullscreen state. + + For applications that want to modify their own state, this request + must be done before the initial surface commit in order to take effect. + + If the application is already in fullscreen state, this request wouldn't + do anything. + + There's no persistence of this request, once the application terminated + you'll to issue this request again for that particular app_id. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + + + + + + + This would allow the compositor to place an application on a particular + output, if that output is indeed available. This can happen before + application is started which would make the application start on that + particular output. If the application is already started it would + move the application to that output. + + There's no persistence of this request, once the application terminated + you'll need to issue this request again for that particular app_id. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + + + + + + + + Clients can use this event to be notified when an application + wants to be displayed on a certain output. This event is sent in + response to the set_app_output request. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + + + + + + + + + This interface allows another client bind to the agl_shell interface, + while there's another shell client already present. + + The client should first bind to this interface and then inform the + compositor with the 'doas_shell_client' request and it wants to bind to + the agl_shell interface. The client is still expected, if using a new + version of the agl_shell interface, to wait for the 'bound_ok' and + 'bound_fail' events before issueing any other requests/events. + + Note that this interface has its limitations, and the compositor would + still refuse the act for 'set_panel' or 'set_background' requests + of the agl_shell interface if there's already a client that used them. + + Any other requests or events should be delievered and handled as it would + a client bound to the agl_shell interface. + + + + + + + + + + Call the destructor once you're ready with agl_shell_ext interface. + This would reset the state and would make any requests made + on the agl_shell interface be terminated. The client would need + to bind again the agl_shell_ext and issue a 'doas_shell_client' + request. + + + + + + Prior to binding to agl_shell interface, this request would inform + the compositor that it wants to gain access the agl_shell interface. + The client is expected to wait for 'doas_shell_client_done' event and + check for a successful status before going further with binding to + the agl_shell interface. + + + + + + The client should check the status event to verify that the + compositor was able to handle the request. + + + diff --git a/ui/platform_window/agl/platform_window_agl.h b/ui/platform_window/agl/platform_window_agl.h index cab1f42272772..b1a6150fff950 100644 --- a/ui/platform_window/agl/platform_window_agl.h +++ b/ui/platform_window/agl/platform_window_agl.h @@ -30,6 +30,7 @@ class PlatformWindowAgl { virtual void SetAglBackground() {} virtual void SetAglPanel(uint32_t edge) {} virtual bool IsSurfaceConfigured() { return false; } + virtual void SetupActivationArea(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {} }; } // namespace ui -- 2.39.2