[cef][wam] Make the recipe work with official chromium release tarballs
[AGL/meta-agl-demo.git] / recipes-wam / cef / files / cef / 0005-Add-AGL-wayland-window-related-calls.patch
1 From ee2c3e430fd0d1025e46c108a79a4e0b07608dff Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Thu, 18 May 2023 10:34:08 +0200
4 Subject: [PATCH 5/9] Add AGL wayland window related calls
5
6 ---
7  include/views/cef_window.h             | 34 ++++++++++++++++
8  libcef/browser/views/view_util.h       | 10 +++++
9  libcef/browser/views/view_util_aura.cc | 54 ++++++++++++++++++++++++++
10  libcef/browser/views/window_impl.cc    | 24 ++++++++++++
11  libcef/browser/views/window_impl.h     | 10 +++++
12  5 files changed, 132 insertions(+)
13
14 diff --git a/include/views/cef_window.h b/include/views/cef_window.h
15 index ec3843b25..22fe2e2a1 100644
16 --- a/include/views/cef_window.h
17 +++ b/include/views/cef_window.h
18 @@ -366,6 +366,40 @@ class CefWindow : public CefPanel {
19    ///
20    /*--cef()--*/
21    virtual void RemoveAllAccelerators() = 0;
22 +
23 +  // AGL-related calls
24 +
25 +  ///
26 +  /// Tells the agl compositor to activate the app
27 +  ///
28 +  /*--cef()--*/
29 +  virtual void AglActivateApp(const CefString& app) = 0;
30 +
31 +  ///
32 +  /// Tells the agl compositor the application id
33 +  ///
34 +  /*--cef()--*/
35 +  virtual void AglSetAppId(const CefString& app_id) = 0;
36 +
37 +  ///
38 +  /// Tells the agl compositor that everything is set-up and good to go
39 +  ///
40 +  /*--cef()--*/
41 +  virtual void AglSetAppReady() = 0;
42 +
43 +  ///
44 +  /// Tells the agl compositor that the app is the background application
45 +  ///
46 +  /*--cef()--*/
47 +  virtual void AglSetBackGroundApp() = 0;
48 +
49 +  ///
50 +  /// Tells the agl compositor that the app is a panel
51 +  ///
52 +  /*--cef()--*/
53 +  virtual void AglSetPanelApp(uint32_t edge) = 0;
54 +
55 +  // -----------------
56  };
57  
58  #endif  // CEF_INCLUDE_VIEWS_CEF_WINDOW_H_
59 diff --git a/libcef/browser/views/view_util.h b/libcef/browser/views/view_util.h
60 index a5fb6e522..bc12a9ddc 100644
61 --- a/libcef/browser/views/view_util.h
62 +++ b/libcef/browser/views/view_util.h
63 @@ -165,6 +165,16 @@ views::View* GetHostView(views::Widget* widget);
64  float GetNSWindowTitleBarHeight(views::Widget* widget);
65  #endif
66  
67 +// AGL-Related calls
68 +
69 +void AglActivateApp(views::Widget* widget, const std::string& app);
70 +void AglSetAppId(views::Widget* widget, const std::string& app_id);
71 +void AglSetAppReady(views::Widget* widget);
72 +void AglSetBackGroundApp(views::Widget* widget);
73 +void AglSetPanelApp(views::Widget* widget, uint32_t edge);
74 +
75 +// -----------------
76 +
77  }  // namespace view_util
78  
79  #endif  // CEF_LIBCEF_BROWSER_VIEWS_VIEW_UTIL_H_
80 diff --git a/libcef/browser/views/view_util_aura.cc b/libcef/browser/views/view_util_aura.cc
81 index 24be3311b..2dabf5eae 100644
82 --- a/libcef/browser/views/view_util_aura.cc
83 +++ b/libcef/browser/views/view_util_aura.cc
84 @@ -58,4 +58,58 @@ views::View* GetHostView(views::Widget* widget) {
85    return widget->GetNativeView()->GetProperty(views::kHostViewKey);
86  }
87  
88 +// AGL-Related calls
89 +
90 +void AglActivateApp(views::Widget* widget, const std::string& app) {
91 +  if (!widget) {
92 +    return;
93 +  }
94 +  aura::Window* window = widget->GetNativeWindow();
95 +  if (window && window->GetRootWindow()) {
96 +    return window->GetHost()->SetAglActivateApp(app);
97 +  }
98 +}
99 +
100 +void AglSetAppId(views::Widget* widget, const std::string& app_id) {
101 +  if (!widget) {
102 +    return;
103 +  }
104 +  aura::Window* window = widget->GetNativeWindow();
105 +  if (window && window->GetRootWindow()) {
106 +    return window->GetHost()->SetAglAppId(app_id);
107 +  }
108 +}
109 +
110 +void AglSetAppReady(views::Widget* widget) {
111 +  if (!widget) {
112 +    return;
113 +  }
114 +  aura::Window* window = widget->GetNativeWindow();
115 +  if (window && window->GetRootWindow()) {
116 +    return window->GetHost()->SetAglReady();
117 +  }
118 +}
119 +
120 +void AglSetBackGroundApp(views::Widget* widget) {
121 +  if (!widget) {
122 +    return;
123 +  }
124 +  aura::Window* window = widget->GetNativeWindow();
125 +  if (window && window->GetRootWindow()) {
126 +    return window->GetHost()->SetAglBackground();
127 +  }
128 +}
129 +
130 +void AglSetPanelApp(views::Widget* widget, uint32_t edge) {
131 +  if (!widget) {
132 +    return;
133 +  }
134 +  aura::Window* window = widget->GetNativeWindow();
135 +  if (window && window->GetRootWindow()) {
136 +    return window->GetHost()->SetAglPanel(edge);
137 +  }
138 +}
139 +
140 +// -----------------
141 +
142  }  // namespace view_util
143 diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc
144 index 3da94b08a..8b347bf4a 100644
145 --- a/libcef/browser/views/window_impl.cc
146 +++ b/libcef/browser/views/window_impl.cc
147 @@ -768,3 +768,27 @@ void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget) {
148      delegate()->OnWindowCreated(this);
149    }
150  }
151 +
152 +// AGL-Related calls
153 +
154 +void CefWindowImpl::AglActivateApp(const CefString& app) {
155 +  view_util::AglActivateApp(widget_, app);
156 +}
157 +
158 +void CefWindowImpl::AglSetAppId(const CefString& app_id) {
159 +  view_util::AglSetAppId(widget_, app_id);
160 +}
161 +
162 +void CefWindowImpl::AglSetAppReady() {
163 +  view_util::AglSetAppReady(widget_);
164 +}
165 +
166 +void CefWindowImpl::AglSetBackGroundApp() {
167 +  view_util::AglSetBackGroundApp(widget_);
168 +}
169 +
170 +void CefWindowImpl::AglSetPanelApp(uint32_t edge) {
171 +  view_util::AglSetPanelApp(widget_, edge);
172 +}
173 +
174 +// -----------------
175 diff --git a/libcef/browser/views/window_impl.h b/libcef/browser/views/window_impl.h
176 index fae0ae832..20514fc32 100644
177 --- a/libcef/browser/views/window_impl.h
178 +++ b/libcef/browser/views/window_impl.h
179 @@ -134,6 +134,16 @@ class CefWindowImpl
180    views::Widget* widget() const { return widget_; }
181    bool initialized() const { return initialized_; }
182  
183 +  // AGL-Related calls
184 +
185 +  void AglActivateApp(const CefString& app) override;
186 +  void AglSetAppId(const CefString& app_id) override;
187 +  void AglSetAppReady() override;
188 +  void AglSetBackGroundApp() override;
189 +  void AglSetPanelApp(uint32_t edge) override;
190 +
191 +  // -----------------
192 +
193   private:
194    // Create a new implementation object.
195    // Always call Initialize() after creation.
196 -- 
197 2.42.0
198