[cef][wam] Make the recipe work with official chromium release tarballs
[AGL/meta-agl-demo.git] / recipes-wam / cef / files / cef / 0006-Add-a-method-to-check-if-the-agl-window-is-configure.patch
1 From 7eefab1c1a8938145f9fb3a5d7a8fa58ca7ad695 Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Fri, 30 Jun 2023 10:27:03 +0200
4 Subject: [PATCH 6/9] Add a method to check if the agl window is configured
5
6 ---
7  include/views/cef_window.h             |  6 ++++++
8  libcef/browser/views/view_util.h       |  1 +
9  libcef/browser/views/view_util_aura.cc | 20 +++++++++++++++-----
10  libcef/browser/views/window_impl.cc    |  4 ++++
11  libcef/browser/views/window_impl.h     |  1 +
12  5 files changed, 27 insertions(+), 5 deletions(-)
13
14 diff --git a/include/views/cef_window.h b/include/views/cef_window.h
15 index 22fe2e2a1..c34963302 100644
16 --- a/include/views/cef_window.h
17 +++ b/include/views/cef_window.h
18 @@ -399,6 +399,12 @@ class CefWindow : public CefPanel {
19    /*--cef()--*/
20    virtual void AglSetPanelApp(uint32_t edge) = 0;
21  
22 +  ///
23 +  /// Tells if the window wayland surface is configured
24 +  ///
25 +  /*--cef()--*/
26 +  virtual bool IsSurfaceConfigured() = 0;
27 +
28    // -----------------
29  };
30  
31 diff --git a/libcef/browser/views/view_util.h b/libcef/browser/views/view_util.h
32 index bc12a9ddc..bf657fd39 100644
33 --- a/libcef/browser/views/view_util.h
34 +++ b/libcef/browser/views/view_util.h
35 @@ -172,6 +172,7 @@ void AglSetAppId(views::Widget* widget, const std::string& app_id);
36  void AglSetAppReady(views::Widget* widget);
37  void AglSetBackGroundApp(views::Widget* widget);
38  void AglSetPanelApp(views::Widget* widget, uint32_t edge);
39 +bool IsSurfaceConfigured(views::Widget* widget);
40  
41  // -----------------
42  
43 diff --git a/libcef/browser/views/view_util_aura.cc b/libcef/browser/views/view_util_aura.cc
44 index 2dabf5eae..2946a2d81 100644
45 --- a/libcef/browser/views/view_util_aura.cc
46 +++ b/libcef/browser/views/view_util_aura.cc
47 @@ -66,7 +66,7 @@ void AglActivateApp(views::Widget* widget, const std::string& app) {
48    }
49    aura::Window* window = widget->GetNativeWindow();
50    if (window && window->GetRootWindow()) {
51 -    return window->GetHost()->SetAglActivateApp(app);
52 +    window->GetHost()->SetAglActivateApp(app);
53    }
54  }
55  
56 @@ -76,7 +76,7 @@ void AglSetAppId(views::Widget* widget, const std::string& app_id) {
57    }
58    aura::Window* window = widget->GetNativeWindow();
59    if (window && window->GetRootWindow()) {
60 -    return window->GetHost()->SetAglAppId(app_id);
61 +    window->GetHost()->SetAglAppId(app_id);
62    }
63  }
64  
65 @@ -86,7 +86,7 @@ void AglSetAppReady(views::Widget* widget) {
66    }
67    aura::Window* window = widget->GetNativeWindow();
68    if (window && window->GetRootWindow()) {
69 -    return window->GetHost()->SetAglReady();
70 +    window->GetHost()->SetAglReady();
71    }
72  }
73  
74 @@ -96,7 +96,7 @@ void AglSetBackGroundApp(views::Widget* widget) {
75    }
76    aura::Window* window = widget->GetNativeWindow();
77    if (window && window->GetRootWindow()) {
78 -    return window->GetHost()->SetAglBackground();
79 +    window->GetHost()->SetAglBackground();
80    }
81  }
82  
83 @@ -106,7 +106,17 @@ void AglSetPanelApp(views::Widget* widget, uint32_t edge) {
84    }
85    aura::Window* window = widget->GetNativeWindow();
86    if (window && window->GetRootWindow()) {
87 -    return window->GetHost()->SetAglPanel(edge);
88 +    window->GetHost()->SetAglPanel(edge);
89 +  }
90 +}
91 +
92 +bool IsSurfaceConfigured(views::Widget* widget) {
93 +  if (!widget) {
94 +    return false;
95 +  }
96 +  aura::Window* window = widget->GetNativeWindow();
97 +  if (window && window->GetRootWindow()) {
98 +    return window->GetHost()->IsSurfaceConfigured();
99    }
100  }
101  
102 diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc
103 index 8b347bf4a..8edac98b5 100644
104 --- a/libcef/browser/views/window_impl.cc
105 +++ b/libcef/browser/views/window_impl.cc
106 @@ -791,4 +791,8 @@ void CefWindowImpl::AglSetPanelApp(uint32_t edge) {
107    view_util::AglSetPanelApp(widget_, edge);
108  }
109  
110 +bool CefWindowImpl::IsSurfaceConfigured() {
111 +  return view_util::IsSurfaceConfigured(widget_);
112 +}
113 +
114  // -----------------
115 diff --git a/libcef/browser/views/window_impl.h b/libcef/browser/views/window_impl.h
116 index 20514fc32..7f7b47e1a 100644
117 --- a/libcef/browser/views/window_impl.h
118 +++ b/libcef/browser/views/window_impl.h
119 @@ -141,6 +141,7 @@ class CefWindowImpl
120    void AglSetAppReady() override;
121    void AglSetBackGroundApp() override;
122    void AglSetPanelApp(uint32_t edge) override;
123 +  bool IsSurfaceConfigured() override;
124  
125    // -----------------
126  
127 -- 
128 2.42.0
129