Shawn Gallea | 787ef55 | 2018-11-27 23:29:24 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_EXO_WAYLAND_ZAURA_SHELL_H_ |
| 6 | #define COMPONENTS_EXO_WAYLAND_ZAURA_SHELL_H_ |
| 7 | |
| 8 | #include <stdint.h> |
| 9 | |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 10 | #include "components/exo/surface.h" |
| 11 | #include "components/exo/surface_observer.h" |
chinsenj | 46a9766 | 2021-07-01 21:37:41 | [diff] [blame] | 12 | #include "ui/gfx/geometry/size_f.h" |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 13 | #include "ui/wm/public/activation_change_observer.h" |
| 14 | |
Shawn Gallea | 787ef55 | 2018-11-27 23:29:24 | [diff] [blame] | 15 | struct wl_client; |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 16 | struct wl_resource; |
Shawn Gallea | 787ef55 | 2018-11-27 23:29:24 | [diff] [blame] | 17 | |
| 18 | namespace exo { |
| 19 | namespace wayland { |
| 20 | |
jonahwilliams | 891aec6 | 2021-09-20 18:55:28 | [diff] [blame] | 21 | constexpr uint32_t kZAuraShellVersion = 24; |
Shawn Gallea | 787ef55 | 2018-11-27 23:29:24 | [diff] [blame] | 22 | |
Daniel Nicoara | e3befc0 | 2019-06-27 19:46:10 | [diff] [blame] | 23 | // Adds bindings to the Aura Shell. Normally this implies Ash on ChromeOS |
| 24 | // builds. On non-ChromeOS builds the protocol provides access to Aura windowing |
| 25 | // system. |
Shawn Gallea | 787ef55 | 2018-11-27 23:29:24 | [diff] [blame] | 26 | void bind_aura_shell(wl_client* client, |
| 27 | void* data, |
| 28 | uint32_t version, |
| 29 | uint32_t id); |
| 30 | |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 31 | class AuraSurface : public SurfaceObserver, |
| 32 | public ::wm::ActivationChangeObserver { |
| 33 | public: |
| 34 | AuraSurface(Surface* surface, wl_resource* resource); |
Peter Boström | 09c0182 | 2021-09-20 22:43:27 | [diff] [blame^] | 35 | |
| 36 | AuraSurface(const AuraSurface&) = delete; |
| 37 | AuraSurface& operator=(const AuraSurface&) = delete; |
| 38 | |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 39 | ~AuraSurface() override; |
| 40 | |
| 41 | void SetFrame(SurfaceFrameType type); |
Mitsuru Oshima | c061d9e | 2021-01-29 18:52:07 | [diff] [blame] | 42 | void SetServerStartResize(); |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 43 | void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); |
| 44 | void SetParent(AuraSurface* parent, const gfx::Point& position); |
| 45 | void SetStartupId(const char* startup_id); |
| 46 | void SetApplicationId(const char* application_id); |
Lloyd Pique | d507c5f | 2020-11-11 22:47:05 | [diff] [blame] | 47 | void SetClientSurfaceId(const char* client_surface_id); |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 48 | void SetOcclusionTracking(bool tracking); |
Nicholas Hollingum | de1f81b5 | 2019-10-09 02:57:18 | [diff] [blame] | 49 | void Activate(); |
| 50 | void DrawAttention(); |
Chloe Pelling | 8a8acdeb | 2020-07-07 10:45:20 | [diff] [blame] | 51 | void SetFullscreenMode(uint32_t mode); |
Antonio Gomes | d7fcbe6 | 2021-02-24 18:30:49 | [diff] [blame] | 52 | void IntentToSnap(uint32_t snap_direction); |
| 53 | void SetSnapLeft(); |
| 54 | void SetSnapRight(); |
| 55 | void UnsetSnap(); |
Shengsong Tan | 394e260 | 2021-04-07 00:25:27 | [diff] [blame] | 56 | void SetWindowSessionId(int32_t window_session_id); |
Antonio Gomes | 22056e2 | 2021-04-16 16:56:19 | [diff] [blame] | 57 | void SetCanGoBack(); |
| 58 | void UnsetCanGoBack(); |
chinsenj | 46a9766 | 2021-07-01 21:37:41 | [diff] [blame] | 59 | void SetPip(); |
| 60 | void UnsetPip(); |
| 61 | void SetAspectRatio(const gfx::SizeF& aspect_ratio); |
Minju Kim | 98aa08c4f | 2021-08-10 02:01:45 | [diff] [blame] | 62 | void MoveToDesk(int desk_index); |
Minju Kim | 3c300e50 | 2021-09-02 09:08:47 | [diff] [blame] | 63 | void SetInitialWorkspace(const char* initial_workspace); |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 64 | |
| 65 | // Overridden from SurfaceObserver: |
| 66 | void OnSurfaceDestroying(Surface* surface) override; |
| 67 | void OnWindowOcclusionChanged(Surface* surface) override; |
Abhijeet Kandalkar | d354a70 | 2021-03-23 21:52:46 | [diff] [blame] | 68 | void OnFrameLockingChanged(Surface* surface, bool lock) override; |
Minju Kim | 98aa08c4f | 2021-08-10 02:01:45 | [diff] [blame] | 69 | void OnDeskChanged(Surface* surface, int state) override; |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 70 | |
| 71 | // Overridden from ActivationChangeObserver: |
| 72 | void OnWindowActivating(ActivationReason reason, |
| 73 | aura::Window* gaining_active, |
| 74 | aura::Window* losing_active) override; |
| 75 | void OnWindowActivated(ActivationReason reason, |
| 76 | aura::Window* gained_active, |
| 77 | aura::Window* lost_active) override {} |
| 78 | |
| 79 | protected: |
| 80 | virtual void SendOcclusionFraction(float occlusion_fraction); |
Eliot Courtney | 62eec49 | 2021-07-15 08:11:51 | [diff] [blame] | 81 | virtual void SendOcclusionState( |
| 82 | const aura::Window::OcclusionState occlusion_state); |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 83 | |
| 84 | private: |
| 85 | Surface* surface_; |
| 86 | wl_resource* const resource_; |
| 87 | |
Eliot Courtney | 62eec49 | 2021-07-15 08:11:51 | [diff] [blame] | 88 | void ComputeAndSendOcclusion( |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 89 | const aura::Window::OcclusionState occlusion_state, |
| 90 | const SkRegion& occluded_region); |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 91 | }; |
| 92 | |
Shawn Gallea | 787ef55 | 2018-11-27 23:29:24 | [diff] [blame] | 93 | } // namespace wayland |
| 94 | } // namespace exo |
| 95 | |
Eliot Courtney | 99f3e9fc | 2019-04-03 09:07:20 | [diff] [blame] | 96 | #endif // COMPONENTS_EXO_WAYLAND_ZAURA_SHELL_H_ |