From 1994e90b6d048e8195739017cb4e4931e3f3ce24 Mon Sep 17 00:00:00 2001 From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Date: Fri, 9 Sep 2022 09:00:27 -0700 Subject: [PATCH 1/3] fix: Backport CL 3753528 for WCO --- shell/browser/ui/views/win_caption_button_container.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/ui/views/win_caption_button_container.cc b/shell/browser/ui/views/win_caption_button_container.cc index 92c0fca690cbd..6501d55000c58 100644 --- a/shell/browser/ui/views/win_caption_button_container.cc +++ b/shell/browser/ui/views/win_caption_button_container.cc @@ -162,7 +162,7 @@ void WinCaptionButtonContainer::UpdateButtons() { // The maximize button should only be enabled if the window is // maximizable *and* touch mode is disabled. const bool maximizable = frame_view_->window()->IsMaximizable(); - maximize_button_->SetEnabled(!is_touch && maximizable); + maximize_button_->SetEnabled(!is_touch || !is_maximized); const bool closable = frame_view_->window()->IsClosable(); close_button_->SetEnabled(closable); From bb7dee6ad54ef1f9c8fbce9c31b2cbfb25a90919 Mon Sep 17 00:00:00 2001 From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Date: Fri, 9 Sep 2022 09:04:45 -0700 Subject: [PATCH 2/3] Update comment --- shell/browser/ui/views/win_caption_button_container.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/browser/ui/views/win_caption_button_container.cc b/shell/browser/ui/views/win_caption_button_container.cc index 6501d55000c58..174d3b54b2d70 100644 --- a/shell/browser/ui/views/win_caption_button_container.cc +++ b/shell/browser/ui/views/win_caption_button_container.cc @@ -159,8 +159,9 @@ void WinCaptionButtonContainer::UpdateButtons() { const bool is_touch = ui::TouchUiController::Get()->touch_ui(); restore_button_->SetEnabled(!is_touch); - // The maximize button should only be enabled if the window is - // maximizable *and* touch mode is disabled. + // In touch mode, windows cannot be taken out of fullscreen or tiled mode, so + // the maximize/restore button should be disabled, unless the window is not + // maximized. const bool maximizable = frame_view_->window()->IsMaximizable(); maximize_button_->SetEnabled(!is_touch || !is_maximized); From f4a66a3f5a7bc8c84b2ca0b7ff64f085a1e778a1 Mon Sep 17 00:00:00 2001 From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Date: Mon, 12 Sep 2022 09:02:00 -0700 Subject: [PATCH 3/3] Update shell/browser/ui/views/win_caption_button_container.cc Co-authored-by: Robo --- shell/browser/ui/views/win_caption_button_container.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/ui/views/win_caption_button_container.cc b/shell/browser/ui/views/win_caption_button_container.cc index 174d3b54b2d70..99a7fc4bc057b 100644 --- a/shell/browser/ui/views/win_caption_button_container.cc +++ b/shell/browser/ui/views/win_caption_button_container.cc @@ -163,7 +163,7 @@ void WinCaptionButtonContainer::UpdateButtons() { // the maximize/restore button should be disabled, unless the window is not // maximized. const bool maximizable = frame_view_->window()->IsMaximizable(); - maximize_button_->SetEnabled(!is_touch || !is_maximized); + maximize_button_->SetEnabled(!(is_touch && is_maximized) && maximizable); const bool closable = frame_view_->window()->IsClosable(); close_button_->SetEnabled(closable);