From d10f885b9327399be9348b780967ebd6b7f2c4bc Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Fri, 7 Feb 2020 22:44:54 +0000 Subject: [PATCH] Rebuild Linux frame button cache when activation state changes This fixes an issue where the frame buttons would always render in an inactive state on Linux (see repro steps in bug 1049258). Bug: 1049258 R=sky CC=pkasting Change-Id: Ic5af33199003e1d1cdf6cedf506e32388ea11fa9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2044538 Auto-Submit: Thomas Anderson Commit-Queue: Scott Violet Reviewed-by: Scott Violet Cr-Commit-Position: refs/heads/master@{#739585} --- .../ui/views/frame/desktop_linux_browser_frame_view.cc | 6 +++--- .../desktop_aura/desktop_window_tree_host_platform.cc | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc b/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc index 954e776057f..4f579955675 100644 --- chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc +++ chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc @@ -22,13 +22,13 @@ DesktopLinuxBrowserFrameView::DesktopLinuxBrowserFrameView( : OpaqueBrowserFrameView(frame, browser_view, layout), nav_button_provider_(std::move(nav_button_provider)) {} -DesktopLinuxBrowserFrameView::~DesktopLinuxBrowserFrameView() {} +DesktopLinuxBrowserFrameView::~DesktopLinuxBrowserFrameView() = default; void DesktopLinuxBrowserFrameView::Layout() { // Calling MaybeUpdateCachedFrameButtonImages() from Layout() is sufficient to // catch all cases that could update the appearance, since - // DesktopWindowTreeHostPlatform::OnWindowStateChanged() does a layout any - // time any properties change. + // DesktopWindowTreeHostPlatform::On{Window,Activation}StateChanged() does a + // layout any time the maximized and activation state changes, respectively. MaybeUpdateCachedFrameButtonImages(); OpaqueBrowserFrameView::Layout(); } diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc index 9c695d8e5b1..9662f19aa90 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc @@ -677,9 +677,12 @@ void DesktopWindowTreeHostPlatform::OnCloseRequest() { } void DesktopWindowTreeHostPlatform::OnActivationChanged(bool active) { + if (is_active_ == active) + return; is_active_ = active; aura::WindowTreeHostPlatform::OnActivationChanged(active); desktop_native_widget_aura_->HandleActivationChanged(active); + ScheduleRelayout(); } base::Optional