electron/patches/chromium/fix_remove_caption-removing_style_call.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
2.4 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
Date: Wed, 17 Aug 2022 13:49:40 -0700
Subject: fix: Adjust caption-removing style call
There is a SetWindowLong call that removes WS_CAPTION for frameless
windows, but Electron uses WS_CAPTION even for frameless windows,
unless they are transparent.
Changing this call only affects frameless windows, and it fixes
a visual glitch where they showed a Windows 7 style frame
during startup.
The if statement was originally introduced by
https://codereview.chromium.org/9372053/, and it was there to fix
a visual glitch with the close button showing up during startup
or resizing, but Electron does not seem to run into that issue
for opaque frameless windows even with that block commented out.
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 06fc8190385139f165bad0c2da2fb22d7a2c3d76..1a10bd1a6c527633f97d6eee6525b1e45a3fcd3d 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
chore: bump chromium to 138.0.7190.0 (37-x-y) (#47349) * chore: bump chromium in DEPS to 138.0.7180.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * 6546797: Add a metric for the overall success of the "safe storage" item retrieval. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6546797 Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android Refs https://chromium-review.googlesource.com/c/chromium/src/+/6548078 Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6544950 Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * chore: bump chromium in DEPS to 138.0.7181.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: update patches Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: correctly clamp HSL shift values between 0 and 1 Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * chore: bump DEPS to 138.0.7183.0 Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * 6553142: Remove SelectFileDialogLinuxKde | https://chromium-review.googlesource.com/c/chromium/src/+/6553142 Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * chore: update patches Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * chore: bump chromium in DEPS to 138.0.7184.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: bump chromium in DEPS to 138.0.7186.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: bump chromium in DEPS to 138.0.7190.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: update patches Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * 6547778: Remove some superfluous //ui/gfx includes from //chrome headers | https://chromium-review.googlesource.com/c/chromium/src/+/6547778 Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * fix: remove pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/4099130 This was removed 2 years ago in Chrome. Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> * fix: provide BrowserContext to pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/6558173 Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> * fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> * fix: pass in navigation throttle registry https://chromium-review.googlesource.com/c/chromium/src/+/6536175 Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> * fixup! 6556022: Reland "FSA: Only normalize the hardcoded rules once during initialization" | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 This partially reverts commit 20d709dd15ba0ff332e24ee314149d642dc5d47c. Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * 6545984: corner-shape: render dashed & dotted borders Refs https://chromium-review.googlesource.com/c/chromium/src/+/6545984 Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> * Update corner smoothing expected images Co-authored-by: clavin <clavin@electronjs.org> * Apply "future" revert commit to fix windows build > Reason for revert: Multiple eng reporting that this is causing build failures due to too-long pathnames, with no immediate feasible workaround This issue also affects our CI builds. Problematic CL in current roll: 6494836: [webgl] Add stub WebGL[2]RenderingContextWebGPU | https://chromium-review.googlesource.com/c/chromium/src/+/6494836 "Future" revert CL: 6565622: Revert "[webgl] Add stub WebGL[2]RenderingContextWebGPU" | https://chromium-review.googlesource.com/c/chromium/src/+/6565622 This patch should automatically disappear when we roll the revert. Co-authored-by: clavin <clavin@electronjs.org> * 6533919: win: don't add WS_CAPTION style to popup windows https://chromium-review.googlesource.com/c/chromium/src/+/6533919 This mirrors the change made earlier to the code ours is based on: 6374074: [headless] Provide headless aware window metrics on Windows | https://chromium-review.googlesource.com/c/chromium/src/+/6374074 Co-authored-by: clavin <clavin@electronjs.org> * chore: update patches --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-06-03 17:06:30 -04:00
@@ -1800,7 +1800,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) {
SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
0);
- if (!delegate_->HasFrame()) {
+ LONG is_popup =
+ GetWindowLong(hwnd(), GWL_STYLE) & static_cast<LONG>(WS_POPUP);
+
+ // For transparent windows, Electron removes the WS_CAPTION style,
+ // so we continue to remove it here. If we didn't, an opaque rectangle
+ // would show up.
+ // For non-transparent windows, Electron keeps the WS_CAPTION style,
+ // so we don't remove it in that case. If we did, a Windows 7 frame
+ // would show up.
+ // We also need this block for frameless popup windows. When the user opens
+ // a dropdown in an Electron app, the internal popup menu from
+ // third_party/blink/renderer/core/html/forms/internal_popup_menu.h
+ // is rendered. That menu is actually an HTML page inside of a frameless popup window.
+ // A new popup window is created every time the user opens the dropdown,
+ // and this code path is run. The code block below runs SendFrameChanged,
+ // which gives the dropdown options the proper layout.
+ if (!delegate_->HasFrame() && (is_translucent_ || is_popup)) {
SetWindowLong(hwnd(), GWL_STYLE,
GetWindowLong(hwnd(), GWL_STYLE) & ~WS_CAPTION);
SendFrameChanged();