aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-html5-demo/recipes-wam/cef/files/cef/0005-Add-AGL-wayland-window-related-calls.patch
blob: d717b81742a07f19027324f7bb25a370a22e8fc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
From ee2c3e430fd0d1025e46c108a79a4e0b07608dff Mon Sep 17 00:00:00 2001
From: Roger Zanoni <rzanoni@igalia.com>
Date: Thu, 18 May 2023 10:34:08 +0200
Subject: [PATCH 5/9] Add AGL wayland window related calls

---
 include/views/cef_window.h             | 34 ++++++++++++++++
 libcef/browser/views/view_util.h       | 10 +++++
 libcef/browser/views/view_util_aura.cc | 54 ++++++++++++++++++++++++++
 libcef/browser/views/window_impl.cc    | 24 ++++++++++++
 libcef/browser/views/window_impl.h     | 10 +++++
 5 files changed, 132 insertions(+)

diff --git a/include/views/cef_window.h b/include/views/cef_window.h
index ec3843b25..22fe2e2a1 100644
--- a/include/views/cef_window.h
+++ b/include/views/cef_window.h
@@ -366,6 +366,40 @@ class CefWindow : public CefPanel {
   ///
   /*--cef()--*/
   virtual void RemoveAllAccelerators() = 0;
+
+  // AGL-related calls
+
+  ///
+  /// Tells the agl compositor to activate the app
+  ///
+  /*--cef()--*/
+  virtual void AglActivateApp(const CefString& app) = 0;
+
+  ///
+  /// Tells the agl compositor the application id
+  ///
+  /*--cef()--*/
+  virtual void AglSetAppId(const CefString& app_id) = 0;
+
+  ///
+  /// Tells the agl compositor that everything is set-up and good to go
+  ///
+  /*--cef()--*/
+  virtual void AglSetAppReady() = 0;
+
+  ///
+  /// Tells the agl compositor that the app is the background application
+  ///
+  /*--cef()--*/
+  virtual void AglSetBackGroundApp() = 0;
+
+  ///
+  /// Tells the agl compositor that the app is a panel
+  ///
+  /*--cef()--*/
+  virtual void AglSetPanelApp(uint32_t edge) = 0;
+
+  // -----------------
 };
 
 #endif  // CEF_INCLUDE_VIEWS_CEF_WINDOW_H_
diff --git a/libcef/browser/views/view_util.h b/libcef/browser/views/view_util.h
index a5fb6e522..bc12a9ddc 100644
--- a/libcef/browser/views/view_util.h
+++ b/libcef/browser/views/view_util.h
@@ -165,6 +165,16 @@ views::View* GetHostView(views::Widget* widget);
 float GetNSWindowTitleBarHeight(views::Widget* widget);
 #endif
 
+// AGL-Related calls
+
+void AglActivateApp(views::Widget* widget, const std::string& app);
+void AglSetAppId(views::Widget* widget, const std::string& app_id);
+void AglSetAppReady(views::Widget* widget);
+void AglSetBackGroundApp(views::Widget* widget);
+void AglSetPanelApp(views::Widget* widget, uint32_t edge);
+
+// -----------------
+
 }  // namespace view_util
 
 #endif  // CEF_LIBCEF_BROWSER_VIEWS_VIEW_UTIL_H_
diff --git a/libcef/browser/views/view_util_aura.cc b/libcef/browser/views/view_util_aura.cc
index 24be3311b..2dabf5eae 100644
--- a/libcef/browser/views/view_util_aura.cc
+++ b/libcef/browser/views/view_util_aura.cc
@@ -58,4 +58,58 @@ views::View* GetHostView(views::Widget* widget) {
   return widget->GetNativeView()->GetProperty(views::kHostViewKey);
 }
 
+// AGL-Related calls
+
+void AglActivateApp(views::Widget* widget, const std::string& app) {
+  if (!widget) {
+    return;
+  }
+  aura::Window* window = widget->GetNativeWindow();
+  if (window && window->GetRootWindow()) {
+    return window->GetHost()->SetAglActivateApp(app);
+  }
+}
+
+void AglSetAppId(views::Widget* widget, const std::string& app_id) {
+  if (!widget) {
+    return;
+  }
+  aura::Window* window = widget->GetNativeWindow();
+  if (window && window->GetRootWindow()) {
+    return window->GetHost()->SetAglAppId(app_id);
+  }
+}
+
+void AglSetAppReady(views::Widget* widget) {
+  if (!widget) {
+    return;
+  }
+  aura::Window* window = widget->GetNativeWindow();
+  if (window && window->GetRootWindow()) {
+    return window->GetHost()->SetAglReady();
+  }
+}
+
+void AglSetBackGroundApp(views::Widget* widget) {
+  if (!widget) {
+    return;
+  }
+  aura::Window* window = widget->GetNativeWindow();
+  if (window && window->GetRootWindow()) {
+    return window->GetHost()->SetAglBackground();
+  }
+}
+
+void AglSetPanelApp(views::Widget* widget, uint32_t edge) {
+  if (!widget) {
+    return;
+  }
+  aura::Window* window = widget->GetNativeWindow();
+  if (window && window->GetRootWindow()) {
+    return window->GetHost()->SetAglPanel(edge);
+  }
+}
+
+// -----------------
+
 }  // namespace view_util
diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc
index 3da94b08a..8b347bf4a 100644
--- a/libcef/browser/views/window_impl.cc
+++ b/libcef/browser/views/window_impl.cc
@@ -768,3 +768,27 @@ void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget) {
     delegate()->OnWindowCreated(this);
   }
 }
+
+// AGL-Related calls
+
+void CefWindowImpl::AglActivateApp(const CefString& app) {
+  view_util::AglActivateApp(widget_, app);
+}
+
+void CefWindowImpl::AglSetAppId(const CefString& app_id) {
+  view_util::AglSetAppId(widget_, app_id);
+}
+
+void CefWindowImpl::AglSetAppReady() {
+  view_util::AglSetAppReady(widget_);
+}
+
+void CefWindowImpl::AglSetBackGroundApp() {
+  view_util::AglSetBackGroundApp(widget_);
+}
+
+void CefWindowImpl::AglSetPanelApp(uint32_t edge) {
+  view_util::AglSetPanelApp(widget_, edge);
+}
+
+// -----------------
diff --git a/libcef/browser/views/window_impl.h b/libcef/browser/views/window_impl.h
index fae0ae832..20514fc32 100644
--- a/libcef/browser/views/window_impl.h
+++ b/libcef/browser/views/window_impl.h
@@ -134,6 +134,16 @@ class CefWindowImpl
   views::Widget* widget() const { return widget_; }
   bool initialized() const { return initialized_; }
 
+  // AGL-Related calls
+
+  void AglActivateApp(const CefString& app) override;
+  void AglSetAppId(const CefString& app_id) override;
+  void AglSetAppReady() override;
+  void AglSetBackGroundApp() override;
+  void AglSetPanelApp(uint32_t edge) override;
+
+  // -----------------
+
  private:
   // Create a new implementation object.
   // Always call Initialize() after creation.
-- 
2.42.0