electron/patches/chromium/fix_activate_background_material_on_windows.patch
electron-roller[bot] 4c3014944c
chore: bump chromium to 129.0.6664.0 (main) (#43329)
* chore: bump chromium in DEPS to 129.0.6657.0

* chore: update patches

* chore: bump chromium in DEPS to 129.0.6658.0

* chore: update patches

* 5743786: [ServiceWorker] Populate service worker start token to WorkerId.

https://chromium-review.googlesource.com/c/chromium/src/+/5743786

* 5784424: [Extensions] Move ownership of Dispatcher to ExtensionsRendererClient

https://chromium-review.googlesource.com/c/chromium/src/+/5784424

* chore: bump chromium in DEPS to 129.0.6659.0

* chore: bump chromium in DEPS to 129.0.6660.0

* chore: update patches

* chore: bump chromium in DEPS to 129.0.6662.0

* chore: bump chromium in DEPS to 129.0.6664.0

* 5789627: [Partitioned Popins] (3) `popin` feature triggers third-party storage partitioning

https://chromium-review.googlesource.com/c/chromium/src/+/5789627

* 5791367: Remove some chrome:: namespace from chrome/browser/app_mode/*

https://chromium-review.googlesource.com/c/chromium/src/+/5791367

* 5791522: [SCK] Skip redundant getShareableContentWithCompletionHandler

https://chromium-review.googlesource.com/c/chromium/src/+/5791522

* 5761330: Send refresh rate prefs b/w RefreshRateController and DisplayPrivate

https://chromium-review.googlesource.com/c/chromium/src/+/5761330

* chore: fixup patch indices

* 5793591: Remove unused GetHeader overload

https://chromium-review.googlesource.com/c/chromium/src/+/5793591

* 5787624: [Extensions] Simplify ExtensionsRendererClient::RenderThreadStarted()

https://chromium-review.googlesource.com/c/chromium/src/+/5787624

* 5721709: Fix Incorrect last_accessed_time Tracking for Tabs

https://chromium-review.googlesource.com/c/chromium/src/+/5721709

* 5789215: [Extensions] Add a //chrome/common/extensions build target

https://chromium-review.googlesource.com/c/chromium/src/+/5789215

* Roll V8 from 48f669a0758c to eee3eb91d01c

48f669a075..eee3eb91d0

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-08-19 14:52:53 -04:00

59 lines
2.5 KiB
Diff

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
index 4aae7e22cf10975df4331ad1628f0da6272e67a8..81c0c3cf4f779bcb3f17a6feb4d76452740e41ad 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -907,13 +907,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,
@@ -2252,17 +2252,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message,
if (IsVisible())
delegate_->SchedulePaint();
- // 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) {