|
1 | | ---- electron/shell/browser/native_window_views.cc.orig 2025-05-22 22:48:48 UTC |
| 1 | +--- electron/shell/browser/native_window_views.cc.orig 2025-06-25 22:07:23 UTC |
2 | 2 | +++ electron/shell/browser/native_window_views.cc |
3 | 3 | @@ -51,7 +51,7 @@ |
4 | 4 | #include "ui/wm/core/shadow_types.h" |
|
9 | 9 | #include "base/strings/string_util.h" |
10 | 10 | #include "shell/browser/browser.h" |
11 | 11 | #include "shell/browser/linux/unity_service.h" |
12 | | -@@ -289,7 +289,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper: |
| 12 | +@@ -298,7 +298,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper: |
13 | 13 | params.parent = parent->GetNativeWindow(); |
14 | 14 |
|
15 | 15 | params.native_widget = new ElectronDesktopNativeWidgetAura(this); |
|
18 | 18 | std::string name = Browser::Get()->GetName(); |
19 | 19 | // Set WM_WINDOW_ROLE. |
20 | 20 | params.wm_role_name = "browser-window"; |
21 | | -@@ -314,7 +314,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper: |
| 21 | +@@ -323,7 +323,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper: |
22 | 22 | std::string window_type; |
23 | 23 | options.Get(options::kType, &window_type); |
24 | 24 |
|
|
27 | 27 | // Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set. |
28 | 28 | if (options.ValueOrDefault(options::kDarkTheme, false)) |
29 | 29 | SetGTKDarkThemeEnabled(true); |
30 | | -@@ -436,7 +436,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper: |
| 30 | +@@ -447,7 +447,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper: |
31 | 31 | if (window) |
32 | 32 | window->AddPreTargetHandler(this); |
33 | 33 |
|
|
36 | 36 | // On linux after the widget is initialized we might have to force set the |
37 | 37 | // bounds if the bounds are smaller than the current display |
38 | 38 | SetBounds(gfx::Rect(GetPosition(), bounds.size()), false); |
39 | | -@@ -472,7 +472,7 @@ void NativeWindowViews::SetGTKDarkThemeEnabled(bool us |
| 39 | +@@ -483,7 +483,7 @@ void NativeWindowViews::SetGTKDarkThemeEnabled(bool us |
40 | 40 | } |
41 | 41 |
|
42 | 42 | void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) { |
|
45 | 45 | if (x11_util::IsX11()) { |
46 | 46 | const std::string color = use_dark_theme ? "dark" : "light"; |
47 | 47 | auto* connection = x11::Connection::Get(); |
48 | | -@@ -533,7 +533,7 @@ void NativeWindowViews::Show() { |
| 48 | +@@ -544,7 +544,7 @@ void NativeWindowViews::Show() { |
49 | 49 |
|
50 | 50 | NotifyWindowShow(); |
51 | 51 |
|
|
54 | 54 | if (global_menu_bar_) |
55 | 55 | global_menu_bar_->OnWindowMapped(); |
56 | 56 |
|
57 | | -@@ -549,7 +549,7 @@ void NativeWindowViews::ShowInactive() { |
| 57 | +@@ -560,7 +560,7 @@ void NativeWindowViews::ShowInactive() { |
58 | 58 |
|
59 | 59 | NotifyWindowShow(); |
60 | 60 |
|
|
63 | 63 | if (global_menu_bar_) |
64 | 64 | global_menu_bar_->OnWindowMapped(); |
65 | 65 |
|
66 | | -@@ -568,7 +568,7 @@ void NativeWindowViews::Hide() { |
| 66 | +@@ -579,7 +579,7 @@ void NativeWindowViews::Hide() { |
67 | 67 |
|
68 | 68 | NotifyWindowHide(); |
69 | 69 |
|
|
72 | 72 | if (global_menu_bar_) |
73 | 73 | global_menu_bar_->OnWindowUnmapped(); |
74 | 74 | #endif |
75 | | -@@ -599,7 +599,7 @@ bool NativeWindowViews::IsEnabled() const { |
| 75 | +@@ -610,7 +610,7 @@ bool NativeWindowViews::IsEnabled() const { |
76 | 76 | bool NativeWindowViews::IsEnabled() const { |
77 | 77 | #if BUILDFLAG(IS_WIN) |
78 | 78 | return ::IsWindowEnabled(GetAcceleratedWidget()); |
|
81 | 81 | if (x11_util::IsX11()) |
82 | 82 | return !event_disabler_.get(); |
83 | 83 | NOTIMPLEMENTED(); |
84 | | -@@ -849,7 +849,7 @@ void NativeWindowViews::SetBounds(const gfx::Rect& bou |
| 84 | +@@ -860,7 +860,7 @@ void NativeWindowViews::SetBounds(const gfx::Rect& bou |
85 | 85 | } |
86 | 86 | #endif |
87 | 87 |
|
|
90 | 90 | // On Linux and Windows the minimum and maximum size should be updated with |
91 | 91 | // window size when window is not resizable. |
92 | 92 | if (!resizable_) { |
93 | | -@@ -1107,7 +1107,7 @@ bool NativeWindowViews::IsClosable() const { |
| 93 | +@@ -1118,7 +1118,7 @@ bool NativeWindowViews::IsClosable() const { |
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | return !(info.fState & MFS_DISABLED); |
|
99 | 99 | return true; |
100 | 100 | #endif |
101 | 101 | } |
102 | | -@@ -1147,7 +1147,7 @@ void NativeWindowViews::Center() { |
| 102 | +@@ -1158,7 +1158,7 @@ void NativeWindowViews::Center() { |
103 | 103 | // for now to avoid breaking API contract, but should consider the long |
104 | 104 | // term plan for this aligning with upstream. |
105 | 105 | void NativeWindowViews::Center() { |
|
108 | 108 | auto display = |
109 | 109 | display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeWindow()); |
110 | 110 | gfx::Rect window_bounds_in_screen = display.work_area(); |
111 | | -@@ -1371,7 +1371,7 @@ void NativeWindowViews::SetMenu(ElectronMenuModel* men |
| 111 | +@@ -1382,7 +1382,7 @@ void NativeWindowViews::SetMenu(ElectronMenuModel* men |
112 | 112 | } |
113 | 113 |
|
114 | 114 | void NativeWindowViews::SetMenu(ElectronMenuModel* menu_model) { |
|
117 | 117 | // Remove global menu bar. |
118 | 118 | if (global_menu_bar_ && menu_model == nullptr) { |
119 | 119 | global_menu_bar_.reset(); |
120 | | -@@ -1427,7 +1427,7 @@ void NativeWindowViews::SetParentWindow(NativeWindow* |
| 120 | +@@ -1438,7 +1438,7 @@ void NativeWindowViews::SetParentWindow(NativeWindow* |
121 | 121 | void NativeWindowViews::SetParentWindow(NativeWindow* parent) { |
122 | 122 | NativeWindow::SetParentWindow(parent); |
123 | 123 |
|
|
126 | 126 | if (x11_util::IsX11()) { |
127 | 127 | auto* connection = x11::Connection::Get(); |
128 | 128 | connection->SetProperty( |
129 | | -@@ -1473,7 +1473,7 @@ void NativeWindowViews::SetProgressBar(double progress |
| 129 | +@@ -1484,7 +1484,7 @@ void NativeWindowViews::SetProgressBar(double progress |
130 | 130 | NativeWindow::ProgressState state) { |
131 | 131 | #if BUILDFLAG(IS_WIN) |
132 | 132 | taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, state); |
|
135 | 135 | if (unity::IsRunning()) { |
136 | 136 | unity::SetProgressFraction(progress); |
137 | 137 | } |
138 | | -@@ -1567,7 +1567,7 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() con |
| 138 | +@@ -1578,7 +1578,7 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() con |
139 | 139 | if (const auto* view_native_widget = widget()->native_widget_private()) |
140 | 140 | return view_native_widget->IsVisibleOnAllWorkspaces(); |
141 | 141 |
|
|
144 | 144 | if (x11_util::IsX11()) { |
145 | 145 | // Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to |
146 | 146 | // determine whether the current window is visible on all workspaces. |
147 | | -@@ -1590,7 +1590,7 @@ content::DesktopMediaID NativeWindowViews::GetDesktopM |
| 147 | +@@ -1601,7 +1601,7 @@ content::DesktopMediaID NativeWindowViews::GetDesktopM |
148 | 148 | #if BUILDFLAG(IS_WIN) |
149 | 149 | window_handle = |
150 | 150 | reinterpret_cast<content::DesktopMediaID::Id>(accelerated_widget); |
|
153 | 153 | window_handle = static_cast<uint32_t>(accelerated_widget); |
154 | 154 | #endif |
155 | 155 | aura::WindowTreeHost* const host = |
156 | | -@@ -1688,7 +1688,7 @@ void NativeWindowViews::SetIcon(HICON window_icon, HIC |
| 156 | +@@ -1699,7 +1699,7 @@ void NativeWindowViews::SetIcon(HICON window_icon, HIC |
157 | 157 | SendMessage(hwnd, WM_SETICON, ICON_BIG, |
158 | 158 | reinterpret_cast<LPARAM>(app_icon_.get())); |
159 | 159 | } |
|
162 | 162 | void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) { |
163 | 163 | auto* tree_host = views::DesktopWindowTreeHostLinux::GetHostForWidget( |
164 | 164 | GetAcceleratedWidget()); |
165 | | -@@ -1784,7 +1784,7 @@ bool NativeWindowViews::CanMinimize() const { |
| 165 | +@@ -1795,7 +1795,7 @@ bool NativeWindowViews::CanMinimize() const { |
166 | 166 | bool NativeWindowViews::CanMinimize() const { |
167 | 167 | #if BUILDFLAG(IS_WIN) |
168 | 168 | return minimizable_; |
|
171 | 171 | return true; |
172 | 172 | #endif |
173 | 173 | } |
174 | | -@@ -1840,7 +1840,7 @@ void NativeWindowViews::HandleKeyboardEvent( |
| 174 | +@@ -1851,7 +1851,7 @@ void NativeWindowViews::HandleKeyboardEvent( |
175 | 175 | if (widget_destroyed_) |
176 | 176 | return; |
177 | 177 |
|
|
180 | 180 | if (event.windows_key_code == ui::VKEY_BROWSER_BACK) |
181 | 181 | NotifyWindowExecuteAppCommand(kBrowserBackward); |
182 | 182 | else if (event.windows_key_code == ui::VKEY_BROWSER_FORWARD) |
183 | | -@@ -1859,7 +1859,7 @@ void NativeWindowViews::OnMouseEvent(ui::MouseEvent* e |
| 183 | +@@ -1870,7 +1870,7 @@ void NativeWindowViews::OnMouseEvent(ui::MouseEvent* e |
184 | 184 | // Alt+Click should not toggle menu bar. |
185 | 185 | root_view_.ResetAltState(); |
186 | 186 |
|
|
0 commit comments