006664d30e4afe4d1b66c576d4d3e739cc52c7d3
[AGL/meta-agl-demo.git] / recipes-wam / cef / files / cef / 0009-Allow-passing-the-app_id-on-widget-creation.patch
1 From 6bd43a70c23d407ca6c4d4a68f0e95eb3301290a Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Tue, 4 Jul 2023 12:10:41 +0200
4 Subject: [PATCH 09/10] Allow passing the app_id on widget creation
5
6 ---
7  include/views/cef_window.h          |  6 ++++++
8  libcef/browser/views/window_impl.cc | 13 +++++++++----
9  libcef/browser/views/window_impl.h  |  6 ++++--
10  libcef/browser/views/window_view.cc |  3 ++-
11  libcef/browser/views/window_view.h  |  2 +-
12  5 files changed, 22 insertions(+), 8 deletions(-)
13
14 diff --git a/include/views/cef_window.h b/include/views/cef_window.h
15 index 52ccb7dc5..fd3e1c1b5 100644
16 --- a/include/views/cef_window.h
17 +++ b/include/views/cef_window.h
18 @@ -63,6 +63,12 @@ class CefWindow : public CefPanel {
19        CefRefPtr<CefWindowDelegate> delegate);
20  
21    ///
22 +  /// Create a new Window with the provided ID
23 +  ///
24 +  /*--cef()--*/
25 +  static CefRefPtr<CefWindow> CreateTopLevelWindowWithId(
26 +      CefRefPtr<CefWindowDelegate> delegate, const CefString& app_id);
27 +  ///
28    /// Show the Window.
29    ///
30    /*--cef()--*/
31 diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc
32 index 485943ec6..35df22c51 100644
33 --- a/libcef/browser/views/window_impl.cc
34 +++ b/libcef/browser/views/window_impl.cc
35 @@ -115,14 +115,19 @@ CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindow(
36    return CefWindowImpl::Create(delegate, gfx::kNullAcceleratedWidget);
37  }
38  
39 +CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindowWithId(
40 +    CefRefPtr<CefWindowDelegate> delegate, const CefString& app_id) {
41 +  return CefWindowImpl::Create(delegate, gfx::kNullAcceleratedWidget, app_id);
42 +}
43 +
44  // static
45  CefRefPtr<CefWindowImpl> CefWindowImpl::Create(
46      CefRefPtr<CefWindowDelegate> delegate,
47 -    gfx::AcceleratedWidget parent_widget) {
48 +    gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
49    CEF_REQUIRE_UIT_RETURN(nullptr);
50    CefRefPtr<CefWindowImpl> window = new CefWindowImpl(delegate);
51    window->Initialize();
52 -  window->CreateWidget(parent_widget);
53 +  window->CreateWidget(parent_widget, app_id);
54    if (delegate)
55      delegate->OnWindowCreated(window.get());
56    return window;
57 @@ -678,10 +683,10 @@ void CefWindowImpl::InitializeRootView() {
58    static_cast<CefWindowView*>(root_view())->Initialize();
59  }
60  
61 -void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget) {
62 +void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
63    DCHECK(!widget_);
64  
65 -  root_view()->CreateWidget(parent_widget);
66 +  root_view()->CreateWidget(parent_widget, app_id);
67    widget_ = root_view()->GetWidget();
68    DCHECK(widget_);
69  
70 diff --git a/libcef/browser/views/window_impl.h b/libcef/browser/views/window_impl.h
71 index 89c136873..d3330dfd8 100644
72 --- a/libcef/browser/views/window_impl.h
73 +++ b/libcef/browser/views/window_impl.h
74 @@ -36,7 +36,8 @@ class CefWindowImpl
75    // Create a new CefWindow instance. |delegate| may be nullptr. |parent_widget|
76    // will be used when creating a Chrome child window.
77    static CefRefPtr<CefWindowImpl> Create(CefRefPtr<CefWindowDelegate> delegate,
78 -                                         gfx::AcceleratedWidget parent_widget);
79 +                                         gfx::AcceleratedWidget parent_widget,
80 +                                         const CefString& app_id = "");
81  
82    // CefWindow methods:
83    void Show() override;
84 @@ -155,7 +156,8 @@ class CefWindowImpl
85    void InitializeRootView() override;
86  
87    // Initialize the Widget.
88 -  void CreateWidget(gfx::AcceleratedWidget parent_widget);
89 +  void CreateWidget(gfx::AcceleratedWidget parent_widget,
90 +                    const CefString& app_id = "");
91  
92    views::Widget* widget_;
93  
94 diff --git a/libcef/browser/views/window_view.cc b/libcef/browser/views/window_view.cc
95 index 1e8d58a32..f4bf79ce3 100644
96 --- a/libcef/browser/views/window_view.cc
97 +++ b/libcef/browser/views/window_view.cc
98 @@ -255,7 +255,7 @@ CefWindowView::CefWindowView(CefWindowDelegate* cef_delegate,
99    DCHECK(window_delegate_);
100  }
101  
102 -void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
103 +void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
104    DCHECK(!GetWidget());
105  
106    // |widget| is owned by the NativeWidget and will be destroyed in response to
107 @@ -265,6 +265,7 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
108  
109    views::Widget::InitParams params;
110    params.delegate = this;
111 +  params.wayland_app_id = app_id;
112  
113    bool can_activate = true;
114    bool can_resize = true;
115 diff --git a/libcef/browser/views/window_view.h b/libcef/browser/views/window_view.h
116 index 6789636b8..ca593c60a 100644
117 --- a/libcef/browser/views/window_view.h
118 +++ b/libcef/browser/views/window_view.h
119 @@ -51,7 +51,7 @@ class CefWindowView
120    CefWindowView& operator=(const CefWindowView&) = delete;
121  
122    // Create the Widget.
123 -  void CreateWidget(gfx::AcceleratedWidget parent_widget);
124 +  void CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id);
125  
126    // Returns the CefWindow associated with this view. See comments on
127    // CefViewView::GetCefView.
128 -- 
129 2.39.2
130