summarylogtreecommitdiffstats
path: root/rebuild-Linux-frame-button-cache-when-activation.patch
blob: 40764b3ba7ab3b2ff642a98f77120952a3f53bd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From d10f885b9327399be9348b780967ebd6b7f2c4bc Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
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 <thomasanderson@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
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
--- a/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc
+++ b/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
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
+++ b/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<gfx::Size>