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.

60 lines
2.5 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 122.0.6236.2 (main) (#40871) * chore: bump chromium in DEPS to 122.0.6223.0 * 5129828: Removes special cases for selenium-atoms dependencies. https://chromium-review.googlesource.com/c/chromium/src/+/5129828 * chore: fixup patch indices * 5139789: Deduplicate BrowserContext's ResourceContext https://chromium-review.googlesource.com/c/chromium/src/+/5139789 * 5148579: Simplify SelectFileDialog::Listener https://chromium-review.googlesource.com/c/chromium/src/+/5148579 * 5134038: Code Health: Use string_view in base::i18n::BreakIterator::SetText https://chromium-review.googlesource.com/c/chromium/src/+/5134038 * 5137427: Code Health: Use string_view in SpellCheck::SpellCheckWord https://chromium-review.googlesource.com/c/chromium/src/+/5137427 * [libcxx] adds ranges::fold_left_with_iter and ranges::fold_left Notable things in this commit: * refactors `__indirect_binary_left_foldable`, making it slightly different (but equivalent) to _`indirect-binary-left-foldable`_, which improves readability (a [patch to the Working Paper][patch] was made) * omits `__cpo` namespace, since it is not required for implementing niebloids (a cleanup should happen in 2024) * puts tests ensuring invocable robustness and dangling correctness inside the correctness testing to ensure that the algorithms' results are still correct [patch]: https://github.com/cplusplus/draft/pull/6734 * chore: bump chromium in DEPS to 122.0.6224.0 * 5154766: [Refresh 2023] [GTK] Fix gap above toolbar with fractional scaling https://chromium-review.googlesource.com/c/chromium/src/+/5154766 * chore: fixup patch indices * 5094458: Remove extra CGColorSpace parameters from skia and ui helpers https://chromium-review.googlesource.com/c/chromium/src/+/5094458 * chore: bump chromium in DEPS to 122.0.6226.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6227.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6228.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6230.0 * chore: bump chromium in DEPS to 122.0.6232.0 * chore: bump chromium in DEPS to 122.0.6234.0 * chore: bump chromium in DEPS to 122.0.6236.2 * chore: update patches * fix: remove --disable-color-correct-renderering Per https://electronhq.slack.com/archives/CB6CG54DB/p1698444047862459 it is not used any more and was never documented. * chore: add WEB_PRINTING to content permission converter Unused in non-cros so no need to document Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5136178 * chore: Views is now vec<raw_ptr> instead of raw<T*> Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5140028 * spec: add Iterator to global intrinsics --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2024-01-11 06:33:40 +00:00
index 64aa90f0fcd7fb2a66b8ea98ab355c4f4f6ffa08..740f92ec4e355032d02138c87d6c4473c8abd3a1 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -901,13 +901,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,
@@ -2254,17 +2254,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) {