blob: efecd6998b84c2c4d848529d66e187035d3fde8f [file] [log] [blame]
Shawn Gallea787ef552018-11-27 23:29:241// 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 Courtney99f3e9fc2019-04-03 09:07:2010#include "components/exo/surface.h"
11#include "components/exo/surface_observer.h"
chinsenj46a97662021-07-01 21:37:4112#include "ui/gfx/geometry/size_f.h"
Eliot Courtney99f3e9fc2019-04-03 09:07:2013#include "ui/wm/public/activation_change_observer.h"
14
Shawn Gallea787ef552018-11-27 23:29:2415struct wl_client;
Eliot Courtney99f3e9fc2019-04-03 09:07:2016struct wl_resource;
Shawn Gallea787ef552018-11-27 23:29:2417
18namespace exo {
19namespace wayland {
20
jonahwilliams891aec62021-09-20 18:55:2821constexpr uint32_t kZAuraShellVersion = 24;
Shawn Gallea787ef552018-11-27 23:29:2422
Daniel Nicoarae3befc02019-06-27 19:46:1023// 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 Gallea787ef552018-11-27 23:29:2426void bind_aura_shell(wl_client* client,
27 void* data,
28 uint32_t version,
29 uint32_t id);
30
Eliot Courtney99f3e9fc2019-04-03 09:07:2031class AuraSurface : public SurfaceObserver,
32 public ::wm::ActivationChangeObserver {
33 public:
34 AuraSurface(Surface* surface, wl_resource* resource);
Peter Boström09c01822021-09-20 22:43:2735
36 AuraSurface(const AuraSurface&) = delete;
37 AuraSurface& operator=(const AuraSurface&) = delete;
38
Eliot Courtney99f3e9fc2019-04-03 09:07:2039 ~AuraSurface() override;
40
41 void SetFrame(SurfaceFrameType type);
Mitsuru Oshimac061d9e2021-01-29 18:52:0742 void SetServerStartResize();
Eliot Courtney99f3e9fc2019-04-03 09:07:2043 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 Piqued507c5f2020-11-11 22:47:0547 void SetClientSurfaceId(const char* client_surface_id);
Eliot Courtney99f3e9fc2019-04-03 09:07:2048 void SetOcclusionTracking(bool tracking);
Nicholas Hollingumde1f81b52019-10-09 02:57:1849 void Activate();
50 void DrawAttention();
Chloe Pelling8a8acdeb2020-07-07 10:45:2051 void SetFullscreenMode(uint32_t mode);
Antonio Gomesd7fcbe62021-02-24 18:30:4952 void IntentToSnap(uint32_t snap_direction);
53 void SetSnapLeft();
54 void SetSnapRight();
55 void UnsetSnap();
Shengsong Tan394e2602021-04-07 00:25:2756 void SetWindowSessionId(int32_t window_session_id);
Antonio Gomes22056e22021-04-16 16:56:1957 void SetCanGoBack();
58 void UnsetCanGoBack();
chinsenj46a97662021-07-01 21:37:4159 void SetPip();
60 void UnsetPip();
61 void SetAspectRatio(const gfx::SizeF& aspect_ratio);
Minju Kim98aa08c4f2021-08-10 02:01:4562 void MoveToDesk(int desk_index);
Minju Kim3c300e502021-09-02 09:08:4763 void SetInitialWorkspace(const char* initial_workspace);
Eliot Courtney99f3e9fc2019-04-03 09:07:2064
65 // Overridden from SurfaceObserver:
66 void OnSurfaceDestroying(Surface* surface) override;
67 void OnWindowOcclusionChanged(Surface* surface) override;
Abhijeet Kandalkard354a702021-03-23 21:52:4668 void OnFrameLockingChanged(Surface* surface, bool lock) override;
Minju Kim98aa08c4f2021-08-10 02:01:4569 void OnDeskChanged(Surface* surface, int state) override;
Eliot Courtney99f3e9fc2019-04-03 09:07:2070
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 Courtney62eec492021-07-15 08:11:5181 virtual void SendOcclusionState(
82 const aura::Window::OcclusionState occlusion_state);
Eliot Courtney99f3e9fc2019-04-03 09:07:2083
84 private:
85 Surface* surface_;
86 wl_resource* const resource_;
87
Eliot Courtney62eec492021-07-15 08:11:5188 void ComputeAndSendOcclusion(
Eliot Courtney99f3e9fc2019-04-03 09:07:2089 const aura::Window::OcclusionState occlusion_state,
90 const SkRegion& occluded_region);
Eliot Courtney99f3e9fc2019-04-03 09:07:2091};
92
Shawn Gallea787ef552018-11-27 23:29:2493} // namespace wayland
94} // namespace exo
95
Eliot Courtney99f3e9fc2019-04-03 09:07:2096#endif // COMPONENTS_EXO_WAYLAND_ZAURA_SHELL_H_