electron/patches/chromium/fix_activate_background_material_on_windows.patch

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

69 lines
2.8 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: clavin <clavin@electronjs.org>
Date: Mon, 11 Dec 2023 20:43:34 -0300
Subject: fix: activate background material on windows
This patch adds a condition to the HWND message handler to allow windows
with translucent background materials to become activated.
It also ensures the lParam of WM_NCACTIVATE is set to -1 so as to not repaint
the client area, which can lead to a title bar incorrectly being displayed in
frameless windows.
This patch likely can't be upstreamed as-is, as Chromium doesn't have
this use case in mind currently.
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
chore: bump chromium to 138.0.7190.0 (main) (#47107) * chore: bump chromium in DEPS to 138.0.7180.0 * 6546797: Add a metric for the overall success of the "safe storage" item retrieval. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6546797 * 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android Refs https://chromium-review.googlesource.com/c/chromium/src/+/6548078 * 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6544950 * chore: bump chromium in DEPS to 138.0.7181.0 * chore: update patches * fix: correctly clamp HSL shift values between 0 and 1 * chore: bump DEPS to 138.0.7183.0 * 6553142: Remove SelectFileDialogLinuxKde | https://chromium-review.googlesource.com/c/chromium/src/+/6553142 * chore: update patches * chore: bump chromium in DEPS to 138.0.7184.0 * chore: bump chromium in DEPS to 138.0.7186.0 * chore: bump chromium in DEPS to 138.0.7190.0 * chore: update patches * 6547778: Remove some superfluous //ui/gfx includes from //chrome headers | https://chromium-review.googlesource.com/c/chromium/src/+/6547778 * 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: remove pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/4099130 This was removed 2 years ago in Chrome. * fix: provide BrowserContext to pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/6558173 * fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: pass in navigation throttle registry https://chromium-review.googlesource.com/c/chromium/src/+/6536175 * 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. * 6545984: corner-shape: render dashed & dotted borders Refs https://chromium-review.googlesource.com/c/chromium/src/+/6545984 * Update corner smoothing expected images * 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. * 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: 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>
2025-06-03 11:19:20 -04:00
index 30399c8a81819a57f07702a97f85e3edd7df9d69..1559eb26fb86ac6172509785afff1e0bbd226ee7 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 (main) (#47107) * chore: bump chromium in DEPS to 138.0.7180.0 * 6546797: Add a metric for the overall success of the "safe storage" item retrieval. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6546797 * 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android Refs https://chromium-review.googlesource.com/c/chromium/src/+/6548078 * 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6544950 * chore: bump chromium in DEPS to 138.0.7181.0 * chore: update patches * fix: correctly clamp HSL shift values between 0 and 1 * chore: bump DEPS to 138.0.7183.0 * 6553142: Remove SelectFileDialogLinuxKde | https://chromium-review.googlesource.com/c/chromium/src/+/6553142 * chore: update patches * chore: bump chromium in DEPS to 138.0.7184.0 * chore: bump chromium in DEPS to 138.0.7186.0 * chore: bump chromium in DEPS to 138.0.7190.0 * chore: update patches * 6547778: Remove some superfluous //ui/gfx includes from //chrome headers | https://chromium-review.googlesource.com/c/chromium/src/+/6547778 * 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: remove pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/4099130 This was removed 2 years ago in Chrome. * fix: provide BrowserContext to pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/6558173 * fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: pass in navigation throttle registry https://chromium-review.googlesource.com/c/chromium/src/+/6536175 * 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. * 6545984: corner-shape: render dashed & dotted borders Refs https://chromium-review.googlesource.com/c/chromium/src/+/6545984 * Update corner smoothing expected images * 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. * 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: 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>
2025-06-03 11:19:20 -04:00
@@ -937,13 +937,13 @@ void HWNDMessageHandler::FrameTypeChanged() {
void HWNDMessageHandler::PaintAsActiveChanged() {
if (!delegate_->HasNonClientView() || !delegate_->CanActivate() ||
- !delegate_->HasFrame() ||
+ (!delegate_->HasFrame() && !is_translucent_) ||
(delegate_->GetFrameMode() == FrameMode::CUSTOM_DRAWN)) {
return;
}
DefWindowProcWithRedrawLock(WM_NCACTIVATE, delegate_->ShouldPaintAsActive(),
- 0);
+ delegate_->HasFrame() ? 0 : -1);
}
void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon,
chore: bump chromium to 138.0.7190.0 (main) (#47107) * chore: bump chromium in DEPS to 138.0.7180.0 * 6546797: Add a metric for the overall success of the "safe storage" item retrieval. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6546797 * 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android Refs https://chromium-review.googlesource.com/c/chromium/src/+/6548078 * 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6544950 * chore: bump chromium in DEPS to 138.0.7181.0 * chore: update patches * fix: correctly clamp HSL shift values between 0 and 1 * chore: bump DEPS to 138.0.7183.0 * 6553142: Remove SelectFileDialogLinuxKde | https://chromium-review.googlesource.com/c/chromium/src/+/6553142 * chore: update patches * chore: bump chromium in DEPS to 138.0.7184.0 * chore: bump chromium in DEPS to 138.0.7186.0 * chore: bump chromium in DEPS to 138.0.7190.0 * chore: update patches * 6547778: Remove some superfluous //ui/gfx includes from //chrome headers | https://chromium-review.googlesource.com/c/chromium/src/+/6547778 * 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: remove pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/4099130 This was removed 2 years ago in Chrome. * fix: provide BrowserContext to pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/6558173 * fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: pass in navigation throttle registry https://chromium-review.googlesource.com/c/chromium/src/+/6536175 * 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. * 6545984: corner-shape: render dashed & dotted borders Refs https://chromium-review.googlesource.com/c/chromium/src/+/6545984 * Update corner smoothing expected images * 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. * 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: 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>
2025-06-03 11:19:20 -04:00
@@ -1732,7 +1732,7 @@ void HWNDMessageHandler::OnActivateApp(BOOL active, DWORD thread_id) {
if (delegate_->HasNonClientView() && !active &&
thread_id != GetCurrentThreadId()) {
// Update the native frame if it is rendering the non-client area.
- if (HasSystemFrame()) {
+ if (is_translucent_ || HasSystemFrame()) {
DefWindowProcWithRedrawLock(WM_NCACTIVATE, FALSE, 0);
}
}
chore: bump chromium to 138.0.7190.0 (main) (#47107) * chore: bump chromium in DEPS to 138.0.7180.0 * 6546797: Add a metric for the overall success of the "safe storage" item retrieval. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6546797 * 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android Refs https://chromium-review.googlesource.com/c/chromium/src/+/6548078 * 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6544950 * chore: bump chromium in DEPS to 138.0.7181.0 * chore: update patches * fix: correctly clamp HSL shift values between 0 and 1 * chore: bump DEPS to 138.0.7183.0 * 6553142: Remove SelectFileDialogLinuxKde | https://chromium-review.googlesource.com/c/chromium/src/+/6553142 * chore: update patches * chore: bump chromium in DEPS to 138.0.7184.0 * chore: bump chromium in DEPS to 138.0.7186.0 * chore: bump chromium in DEPS to 138.0.7190.0 * chore: update patches * 6547778: Remove some superfluous //ui/gfx includes from //chrome headers | https://chromium-review.googlesource.com/c/chromium/src/+/6547778 * 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: remove pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/4099130 This was removed 2 years ago in Chrome. * fix: provide BrowserContext to pdf_extension_util::AddAdditionalData https://chromium-review.googlesource.com/c/chromium/src/+/6558173 * fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | https://chromium-review.googlesource.com/c/chromium/src/+/6556022 * fix: pass in navigation throttle registry https://chromium-review.googlesource.com/c/chromium/src/+/6536175 * 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. * 6545984: corner-shape: render dashed & dotted borders Refs https://chromium-review.googlesource.com/c/chromium/src/+/6545984 * Update corner smoothing expected images * 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. * 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: 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>
2025-06-03 11:19:20 -04:00
@@ -2340,17 +2340,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message,
delegate_->SchedulePaint();
chore: bump chromium to 133.0.6920.0 (main) (#45055) * chore: bump chromium in DEPS to 133.0.6902.0 * chore: bump chromium in DEPS to 133.0.6903.0 * chore: update patches * Update PdfViewer Save File Picker to use showSaveFilePicker. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6074308 * Code Health: Clean up stale MacWebContentsOcclusion Refs https://chromium-review.googlesource.com/c/chromium/src/+/6078344 * Change RenderProcessHost::GetID to RenderProcessHost::GetDeprecatedID Refs https://chromium-review.googlesource.com/c/chromium/src/+/6065543 * [WebRTC] Make WebRTC IP Handling policy a mojo enum Refs https://chromium-review.googlesource.com/c/chromium/src/+/6063620 * chore: gen filenames.libcxx.gni * Remove allow_unsafe_buffers pragma in //printing Refs https://chromium-review.googlesource.com/c/chromium/src/+/6092280 * refactor: to use ChildProcessId where possible Refs https://issues.chromium.org/issues/379869738 * [Win] Update TabletMode detection code Refs https://chromium-review.googlesource.com/c/chromium/src/+/6003486 * chore: bump chromium in DEPS to 133.0.6905.0 * chore: update patches * Reland "Move global shortcut listener to //ui/base" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6099035 * [shared storage] Implement the batch `with_lock` option for response header Refs https://chromium-review.googlesource.com/c/chromium/src/+/6072742 * chore: bump chromium in DEPS to 133.0.6907.0 * chore: bump chromium in DEPS to 133.0.6909.0 * chore: bump chromium in DEPS to 133.0.6911.0 * chore: bump chromium in DEPS to 133.0.6912.0 * chore: update patches * WebUI: Reveal hidden deps to ui/webui/resources. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6096291 * chore: bump chromium in DEPS to 133.0.6913.0 * chore: bump chromium in DEPS to 133.0.6915.0 * Code Health: Clean up stale base::Feature "AccessibilityTreeForViews" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6104174 Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: remove fastapitypedarray usage * chore: update patches * chore: script/gen-libc++-filenames.js * Code Health: Clean up stale base::Feature "WinRetrieveSuggestionsOnlyOnDemand" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6109477 * fix: empty suggestions with windows platform checker Amends the fix from https://github.com/electron/electron/pull/29690 since the feature flag is no longer available. We follow the same pattern as //chrome/browser/renderer_context_menu/spelling_menu_observer.cc to generate the suggestion list on demand when context menu action is invoked. Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fixup! fix: empty suggestions with windows platform checker * fixup! fix: empty suggestions with windows platform checker * revert: 6078344: Code Health: Clean up stale MacWebContentsOcclusion | https://chromium-review.googlesource.com/c/chromium/src/+/6078344 * Revert "revert: 6078344: Code Health: Clean up stale MacWebContentsOcclusion | https://chromium-review.googlesource.com/c/chromium/src/+/6078344" This reverts commit 9cacda452ed5a072351e8f5a35b009d91843a08c. * chore: bump to 133.0.6920.0, update patches * Revert "6078344: Code Health: Clean up stale MacWebContentsOcclusion" Refs: https://chromium-review.googlesource.com/c/chromium/src/+/6078344 * fixup! Update PdfViewer Save File Picker to use showSaveFilePicker. --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-01-10 10:52:34 -06:00
}
- // Calling DefWindowProc is only necessary if there's a system frame being
- // drawn. Otherwise it can draw an incorrect title bar and cause visual
- // corruption.
- if (!delegate_->HasFrame() ||
+ // If the window is translucent, it may have the Mica background.
+ // In that case, it's necessary to call |DefWindowProc|, but we can
+ // pass -1 in the lParam to prevent any non-client area elements from
+ // being displayed.
+ if ((!delegate_->HasFrame() && !is_translucent_) ||
delegate_->GetFrameMode() == FrameMode::CUSTOM_DRAWN) {
SetMsgHandled(TRUE);
return TRUE;
}
return DefWindowProcWithRedrawLock(WM_NCACTIVATE, paint_as_active || active,
- 0);
+ delegate_->HasFrame() ? 0 : -1);
}
LRESULT HWNDMessageHandler::OnNCCalcSize(BOOL mode, LPARAM l_param) {