fix: WCO buttons hidden on Linux in fullscreen (#44641)
Closes https://github.com/electron/electron/issues/44569. Fixes an issue where the WCO buttons were hidden on Linux in fullscreen mode but not on Windows or macOS. The Windows behavior is the expected one, so this commit makes the Linux behavior consistent. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
da390c193b
commit
5b3a1a7195
1 changed files with 18 additions and 13 deletions
|
@ -255,14 +255,17 @@ void OpaqueFrameView::LayoutWindowControls() {
|
|||
buttons_not_shown.push_back(views::FrameButton::kMinimize);
|
||||
buttons_not_shown.push_back(views::FrameButton::kClose);
|
||||
|
||||
for (const auto& button : leading_buttons_) {
|
||||
ConfigureButton(button, ALIGN_LEADING);
|
||||
std::erase(buttons_not_shown, button);
|
||||
}
|
||||
// We do not want to show the buttons in fullscreen mode.
|
||||
if (!frame()->IsFullscreen()) {
|
||||
for (const auto& button : leading_buttons_) {
|
||||
ConfigureButton(button, ALIGN_LEADING);
|
||||
std::erase(buttons_not_shown, button);
|
||||
}
|
||||
|
||||
for (const auto& button : base::Reversed(trailing_buttons_)) {
|
||||
ConfigureButton(button, ALIGN_TRAILING);
|
||||
std::erase(buttons_not_shown, button);
|
||||
for (const auto& button : base::Reversed(trailing_buttons_)) {
|
||||
ConfigureButton(button, ALIGN_TRAILING);
|
||||
std::erase(buttons_not_shown, button);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& button_id : buttons_not_shown)
|
||||
|
@ -401,8 +404,7 @@ void OpaqueFrameView::ConfigureButton(views::FrameButton button_id,
|
|||
ButtonAlignment alignment) {
|
||||
switch (button_id) {
|
||||
case views::FrameButton::kMinimize: {
|
||||
bool can_minimize = true; // delegate_->CanMinimize();
|
||||
if (can_minimize) {
|
||||
if (window()->IsMinimizable()) {
|
||||
minimize_button_->SetVisible(true);
|
||||
SetBoundsForButton(button_id, minimize_button_, alignment);
|
||||
} else {
|
||||
|
@ -411,8 +413,7 @@ void OpaqueFrameView::ConfigureButton(views::FrameButton button_id,
|
|||
break;
|
||||
}
|
||||
case views::FrameButton::kMaximize: {
|
||||
bool can_maximize = true; // delegate_->CanMaximize();
|
||||
if (can_maximize) {
|
||||
if (window()->IsMaximizable()) {
|
||||
// When the window is restored, we show a maximized button; otherwise,
|
||||
// we show a restore button.
|
||||
bool is_restored = !window()->IsMaximized() && !window()->IsMinimized();
|
||||
|
@ -430,8 +431,12 @@ void OpaqueFrameView::ConfigureButton(views::FrameButton button_id,
|
|||
break;
|
||||
}
|
||||
case views::FrameButton::kClose: {
|
||||
close_button_->SetVisible(true);
|
||||
SetBoundsForButton(button_id, close_button_, alignment);
|
||||
if (window()->IsClosable()) {
|
||||
close_button_->SetVisible(true);
|
||||
SetBoundsForButton(button_id, close_button_, alignment);
|
||||
} else {
|
||||
HideButton(button_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue