-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
11 deletions.
There are no files selected for viewing
24 changes: 13 additions & 11 deletions
24
patches/chromium/fix_remove_caption-removing_style_call.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
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: Remove caption-removing style call | ||
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. | ||
windows, but Electron uses WS_CAPTION even for frameless windows, | ||
unless they are transparent. | ||
|
||
Removing this call only affects frameless windows, and it fixes | ||
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 frameless windows even with that block commented out. | ||
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 1f883dc7d46d5cc3fddffe75c55e6b96fb0fc5f2..7a7403e2129baf228474971dcb8a565ae6a0f683 100644 | ||
index 1f883dc7d46d5cc3fddffe75c55e6b96fb0fc5f2..74df546e72c81b6bddd4b8c96b721361dc520ba4 100644 | ||
--- a/ui/views/win/hwnd_message_handler.cc | ||
+++ b/ui/views/win/hwnd_message_handler.cc | ||
@@ -1727,8 +1727,10 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { | ||
@@ -1726,7 +1726,10 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { | ||
SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), | ||
0); | ||
|
||
if (!delegate_->HasFrame()) { | ||
+#if 0 | ||
- if (!delegate_->HasFrame()) { | ||
+ // For (frameless) transparent windows, Electron removes the WS_CAPTION style, | ||
+ // so we can preserve this code block. Otherwise, an opaque rectangle | ||
+ // shows up. | ||
+ if (!delegate_->HasFrame() && is_translucent_) { | ||
SetWindowLong(hwnd(), GWL_STYLE, | ||
GetWindowLong(hwnd(), GWL_STYLE) & ~WS_CAPTION); | ||
+#endif | ||
SendFrameChanged(); | ||
} | ||
|