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
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(+)
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 {
21 virtual void RemoveAllAccelerators() = 0;
23 + // AGL-related calls
26 + /// Tells the agl compositor to activate the app
29 + virtual void AglActivateApp(const CefString& app) = 0;
32 + /// Tells the agl compositor the application id
35 + virtual void AglSetAppId(const CefString& app_id) = 0;
38 + /// Tells the agl compositor that everything is set-up and good to go
41 + virtual void AglSetAppReady() = 0;
44 + /// Tells the agl compositor that the app is the background application
47 + virtual void AglSetBackGroundApp() = 0;
50 + /// Tells the agl compositor that the app is a panel
53 + virtual void AglSetPanelApp(uint32_t edge) = 0;
55 + // -----------------
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);
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);
77 } // namespace view_util
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);
90 +void AglActivateApp(views::Widget* widget, const std::string& app) {
94 + aura::Window* window = widget->GetNativeWindow();
95 + if (window && window->GetRootWindow()) {
96 + return window->GetHost()->SetAglActivateApp(app);
100 +void AglSetAppId(views::Widget* widget, const std::string& app_id) {
104 + aura::Window* window = widget->GetNativeWindow();
105 + if (window && window->GetRootWindow()) {
106 + return window->GetHost()->SetAglAppId(app_id);
110 +void AglSetAppReady(views::Widget* widget) {
114 + aura::Window* window = widget->GetNativeWindow();
115 + if (window && window->GetRootWindow()) {
116 + return window->GetHost()->SetAglReady();
120 +void AglSetBackGroundApp(views::Widget* widget) {
124 + aura::Window* window = widget->GetNativeWindow();
125 + if (window && window->GetRootWindow()) {
126 + return window->GetHost()->SetAglBackground();
130 +void AglSetPanelApp(views::Widget* widget, uint32_t edge) {
134 + aura::Window* window = widget->GetNativeWindow();
135 + if (window && window->GetRootWindow()) {
136 + return window->GetHost()->SetAglPanel(edge);
140 +// -----------------
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);
152 +// AGL-Related calls
154 +void CefWindowImpl::AglActivateApp(const CefString& app) {
155 + view_util::AglActivateApp(widget_, app);
158 +void CefWindowImpl::AglSetAppId(const CefString& app_id) {
159 + view_util::AglSetAppId(widget_, app_id);
162 +void CefWindowImpl::AglSetAppReady() {
163 + view_util::AglSetAppReady(widget_);
166 +void CefWindowImpl::AglSetBackGroundApp() {
167 + view_util::AglSetBackGroundApp(widget_);
170 +void CefWindowImpl::AglSetPanelApp(uint32_t edge) {
171 + view_util::AglSetPanelApp(widget_, edge);
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_; }
183 + // AGL-Related calls
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;
191 + // -----------------
194 // Create a new implementation object.
195 // Always call Initialize() after creation.