electron/patches/chromium/fix_activate_background_material_on_windows.patch
electron-roller[bot] 5db776f1ec
chore: bump chromium to 128.0.6613.7 (32-x-y) (#42823)
* chore: bump chromium in DEPS to 128.0.6583.1

* chore: bump chromium in DEPS to 128.0.6585.0

* chore: bump chromium in DEPS to 128.0.6587.0

* chore: bump chromium in DEPS to 128.0.6589.1

* chore: bump chromium in DEPS to 128.0.6591.1

* chore: bump chromium in DEPS to 128.0.6593.0

* chore: bump chromium in DEPS to 128.0.6595.0

* chore: bump chromium in DEPS to 128.0.6597.1

* chore: bump chromium in DEPS to 128.0.6598.0

* chore: bump chromium in DEPS to 128.0.6601.1

* chore: bump chromium in DEPS to 128.0.6603.1

* chore: bump chromium in DEPS to 128.0.6605.2

* chore: bump chromium in DEPS to 128.0.6606.1

* chore: bump chromium in DEPS to 128.0.6607.1

* chore: bump chromium in DEPS to 128.0.6609.0

* chore: bump chromium in DEPS to 128.0.6611.0

* chore: bump chromium in DEPS to 128.0.6613.0

* chore: bump chromium in DEPS to 128.0.6613.7

* chore: update patches

* chore: 5725076: Update EventType names | https://chromium-review.googlesource.com/c/chromium/src/+/5725076

(cherry picked from commit 639d741ba5ac50e800ca46138557c7a32d1b7752)

* chore: 5725076: Update EventType names | https://chromium-review.googlesource.com/c/chromium/src/+/5725076 for windows

(cherry picked from commit 744c17fe92911baa0c7355af905aabb9d12bae18)

* 5730656: Show an error dialog when UpdatePrintSettings() fails

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

---------

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: Alice Zhao <alice@makenotion.com>
2024-07-29 12:00:10 +02: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 8bb4db2d74146718dfb3192ef272dbc2f0fe5921..e0f61ff2a3f1412346ce3dbe1d9de88a86a3de38 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,
@@ -2261,17 +2261,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) {