electron/patches/chromium/fix_activate_background_material_on_windows.patch
trop[bot] 500d453a63
chore: bump chromium to 132.0.6834.0 (34-x-y) (#44666)
* chore: bump chromium in DEPS to 132.0.6827.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 132.0.6828.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 132.0.6830.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 132.0.6832.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 132.0.6834.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update chromium patches

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* 5977022: Apply os setting of overlay scrollbar to web instances | https://chromium-review.googlesource.com/c/chromium/src/+/5977022

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* 5991440: Cleanup //ui/compositor from LaCros support code. | https://chromium-review.googlesource.com/c/chromium/src/+/5991440

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* chore: update all patches

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* 6000058: Add base_subdirs to file_chooser.mojom NativeFileInfo | https://chromium-review.googlesource.com/c/chromium/src/+/6000058

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* 6009949: Rename NOTREACHED_NORETURN() uses to NOTREACHED() | https://chromium-review.googlesource.com/c/chromium/src/+/6009949

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* 5966419: [freezing] Expose frozen state to extensions (3/3 - add frozen to chrome.tabs.Tab).

https://chromium-review.googlesource.com/c/chromium/src/+/5966419
Also https://chromium-review.googlesource.com/c/chromium/src/+/6006424

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

---------

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: VerteDinde <vertedinde@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-11-14 20:56:18 -05: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 fda18ecab7e982b3087c7667d36578177d370066..a949e73dabad71d2550e38b09dbcf45160b3a853 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -908,13 +908,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,
@@ -2256,17 +2256,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) {