summaryrefslogtreecommitdiffstats
path: root/recipes-wam/cef/files/cef/0009-Allow-passing-the-app_id-on-widget-creation.patch
blob: 006664d30e4afe4d1b66c576d4d3e739cc52c7d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
From 6bd43a70c23d407ca6c4d4a68f0e95eb3301290a Mon Sep 17 00:00:00 2001
From: Roger Zanoni <rzanoni@igalia.com>
Date: Tue, 4 Jul 2023 12:10:41 +0200
Subject: [PATCH 09/10] Allow passing the app_id on widget creation

---
 include/views/cef_window.h          |  6 ++++++
 libcef/browser/views/window_impl.cc | 13 +++++++++----
 libcef/browser/views/window_impl.h  |  6 ++++--
 libcef/browser/views/window_view.cc |  3 ++-
 libcef/browser/views/window_view.h  |  2 +-
 5 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/include/views/cef_window.h b/include/views/cef_window.h
index 52ccb7dc5..fd3e1c1b5 100644
--- a/include/views/cef_window.h
+++ b/include/views/cef_window.h
@@ -63,6 +63,12 @@ class CefWindow : public CefPanel {
       CefRefPtr<CefWindowDelegate> delegate);
 
   ///
+  /// Create a new Window with the provided ID
+  ///
+  /*--cef()--*/
+  static CefRefPtr<CefWindow> CreateTopLevelWindowWithId(
+      CefRefPtr<CefWindowDelegate> delegate, const CefString& app_id);
+  ///
   /// Show the Window.
   ///
   /*--cef()--*/
diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc
index 485943ec6..35df22c51 100644
--- a/libcef/browser/views/window_impl.cc
+++ b/libcef/browser/views/window_impl.cc
@@ -115,14 +115,19 @@ CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindow(
   return CefWindowImpl::Create(delegate, gfx::kNullAcceleratedWidget);
 }
 
+CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindowWithId(
+    CefRefPtr<CefWindowDelegate> delegate, const CefString& app_id) {
+  return CefWindowImpl::Create(delegate, gfx::kNullAcceleratedWidget, app_id);
+}
+
 // static
 CefRefPtr<CefWindowImpl> CefWindowImpl::Create(
     CefRefPtr<CefWindowDelegate> delegate,
-    gfx::AcceleratedWidget parent_widget) {
+    gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
   CEF_REQUIRE_UIT_RETURN(nullptr);
   CefRefPtr<CefWindowImpl> window = new CefWindowImpl(delegate);
   window->Initialize();
-  window->CreateWidget(parent_widget);
+  window->CreateWidget(parent_widget, app_id);
   if (delegate)
     delegate->OnWindowCreated(window.get());
   return window;
@@ -678,10 +683,10 @@ void CefWindowImpl::InitializeRootView() {
   static_cast<CefWindowView*>(root_view())->Initialize();
 }
 
-void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget) {
+void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
   DCHECK(!widget_);
 
-  root_view()->CreateWidget(parent_widget);
+  root_view()->CreateWidget(parent_widget, app_id);
   widget_ = root_view()->GetWidget();
   DCHECK(widget_);
 
diff --git a/libcef/browser/views/window_impl.h b/libcef/browser/views/window_impl.h
index 89c136873..d3330dfd8 100644
--- a/libcef/browser/views/window_impl.h
+++ b/libcef/browser/views/window_impl.h
@@ -36,7 +36,8 @@ class CefWindowImpl
   // Create a new CefWindow instance. |delegate| may be nullptr. |parent_widget|
   // will be used when creating a Chrome child window.
   static CefRefPtr<CefWindowImpl> Create(CefRefPtr<CefWindowDelegate> delegate,
-                                         gfx::AcceleratedWidget parent_widget);
+                                         gfx::AcceleratedWidget parent_widget,
+                                         const CefString& app_id = "");
 
   // CefWindow methods:
   void Show() override;
@@ -155,7 +156,8 @@ class CefWindowImpl
   void InitializeRootView() override;
 
   // Initialize the Widget.
-  void CreateWidget(gfx::AcceleratedWidget parent_widget);
+  void CreateWidget(gfx::AcceleratedWidget parent_widget,
+                    const CefString& app_id = "");
 
   views::Widget* widget_;
 
diff --git a/libcef/browser/views/window_view.cc b/libcef/browser/views/window_view.cc
index 1e8d58a32..f4bf79ce3 100644
--- a/libcef/browser/views/window_view.cc
+++ b/libcef/browser/views/window_view.cc
@@ -255,7 +255,7 @@ CefWindowView::CefWindowView(CefWindowDelegate* cef_delegate,
   DCHECK(window_delegate_);
 }
 
-void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
+void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id) {
   DCHECK(!GetWidget());
 
   // |widget| is owned by the NativeWidget and will be destroyed in response to
@@ -265,6 +265,7 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
 
   views::Widget::InitParams params;
   params.delegate = this;
+  params.wayland_app_id = app_id;
 
   bool can_activate = true;
   bool can_resize = true;
diff --git a/libcef/browser/views/window_view.h b/libcef/browser/views/window_view.h
index 6789636b8..ca593c60a 100644
--- a/libcef/browser/views/window_view.h
+++ b/libcef/browser/views/window_view.h
@@ -51,7 +51,7 @@ class CefWindowView
   CefWindowView& operator=(const CefWindowView&) = delete;
 
   // Create the Widget.
-  void CreateWidget(gfx::AcceleratedWidget parent_widget);
+  void CreateWidget(gfx::AcceleratedWidget parent_widget, const CefString& app_id);
 
   // Returns the CefWindow associated with this view. See comments on
   // CefViewView::GetCefView.
-- 
2.39.2