1 From efba58d289ad381c6ca9fae9ded040c816946894 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 06/10] 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 e34e446bd..dfa7821bc 100644
16 --- a/include/views/cef_window.h
17 +++ b/include/views/cef_window.h
18 @@ -348,6 +348,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 302eee464..505c66d94 100644
61 --- a/libcef/browser/views/view_util.h
62 +++ b/libcef/browser/views/view_util.h
63 @@ -141,6 +141,16 @@ CefWindowHandle GetWindowHandle(views::Widget* widget);
64 // Returns the platform window handle for |window|. May return nullptr.
65 CefWindowHandle GetWindowHandle(gfx::NativeWindow window);
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 8a144eb33..2ad2f3dc7 100644
82 --- a/libcef/browser/views/view_util_aura.cc
83 +++ b/libcef/browser/views/view_util_aura.cc
84 @@ -39,4 +39,58 @@ CefWindowHandle GetWindowHandle(gfx::NativeWindow window) {
85 return kNullWindowHandle;
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 64e5c443e..22a4d39f6 100644
145 --- a/libcef/browser/views/window_impl.cc
146 +++ b/libcef/browser/views/window_impl.cc
147 @@ -522,6 +522,30 @@ CefWindowHandle CefWindowImpl::GetWindowHandle() {
148 return view_util::GetWindowHandle(widget_);
151 +// AGL-Related calls
153 +void CefWindowImpl::AglActivateApp(const CefString& app) {
154 + view_util::AglActivateApp(widget_, app);
157 +void CefWindowImpl::AglSetAppId(const CefString& app_id) {
158 + view_util::AglSetAppId(widget_, app_id);
161 +void CefWindowImpl::AglSetAppReady() {
162 + view_util::AglSetAppReady(widget_);
165 +void CefWindowImpl::AglSetBackGroundApp() {
166 + view_util::AglSetBackGroundApp(widget_);
169 +void CefWindowImpl::AglSetPanelApp(uint32_t edge) {
170 + view_util::AglSetPanelApp(widget_, edge);
173 +// -----------------
175 void CefWindowImpl::SendKeyPress(int key_code, uint32 event_flags) {
176 CEF_REQUIRE_VALID_RETURN_VOID();
177 InitializeUITesting();
178 diff --git a/libcef/browser/views/window_impl.h b/libcef/browser/views/window_impl.h
179 index f9557d415..ad02904f9 100644
180 --- a/libcef/browser/views/window_impl.h
181 +++ b/libcef/browser/views/window_impl.h
182 @@ -132,6 +132,16 @@ class CefWindowImpl
184 views::Widget* widget() const { return widget_; }
186 + // AGL-Related calls
188 + void AglActivateApp(const CefString& app) override;
189 + void AglSetAppId(const CefString& app_id) override;
190 + void AglSetAppReady() override;
191 + void AglSetBackGroundApp() override;
192 + void AglSetPanelApp(uint32_t edge) override;
194 + // -----------------
197 // Create a new implementation object.
198 // Always call Initialize() after creation.