From 19cfa2a8d363ec729051f044af99477a11b4ae20 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2020 20:47:44 -0700 Subject: [PATCH] fix: do not render inactive titlebar as active on Windows (#24875) Co-authored-by: Cheng Zhao --- .../ui/win/electron_desktop_window_tree_host_win.cc | 8 ++++++++ .../ui/win/electron_desktop_window_tree_host_win.h | 1 + 2 files changed, 9 insertions(+) diff --git a/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc b/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc index 18ad4555c7121..8fc9b230e696c 100644 --- a/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc +++ b/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc @@ -24,6 +24,14 @@ bool ElectronDesktopWindowTreeHostWin::PreHandleMSG(UINT message, return native_window_view_->PreHandleMSG(message, w_param, l_param, result); } +bool ElectronDesktopWindowTreeHostWin::ShouldPaintAsActive() const { + // Tell Chromium to use system default behavior when rendering inactive + // titlebar, otherwise it would render inactive titlebar as active under + // some cases. + // See also https://github.com/electron/electron/issues/24647. + return false; +} + bool ElectronDesktopWindowTreeHostWin::HasNativeFrame() const { // Since we never use chromium's titlebar implementation, we can just say // that we use a native titlebar. This will disable the repaint locking when diff --git a/shell/browser/ui/win/electron_desktop_window_tree_host_win.h b/shell/browser/ui/win/electron_desktop_window_tree_host_win.h index 3c8f9692b50e0..9aa3b8fb11434 100644 --- a/shell/browser/ui/win/electron_desktop_window_tree_host_win.h +++ b/shell/browser/ui/win/electron_desktop_window_tree_host_win.h @@ -25,6 +25,7 @@ class ElectronDesktopWindowTreeHostWin WPARAM w_param, LPARAM l_param, LRESULT* result) override; + bool ShouldPaintAsActive() const override; bool HasNativeFrame() const override; bool GetClientAreaInsets(gfx::Insets* insets, HMONITOR monitor) const override;