From ee2c3e430fd0d1025e46c108a79a4e0b07608dff Mon Sep 17 00:00:00 2001 From: Roger Zanoni 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