From 7cc64927b88c4fbb9d3ff3e8bd1f8075bc79ce23 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 25 Nov 2020 09:04:15 +1100 Subject: [PATCH] mainwindow: when maximizing panels, fallback to focused panel if hovered panel is null Fixes #1403 --- app/window/mainwindow/mainwindow.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 8426fa8cf..d9d14ec1f 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -274,9 +274,14 @@ void MainWindow::ToggleMaximizedPanel() // Find the currently focused panel PanelWidget* currently_hovered = PanelManager::instance()->CurrentlyHovered(); - // If no panel is hovered, do nothing - if (currently_hovered == nullptr) { - return; + // If no panel is hovered, fallback to the currently active panel + if (!currently_hovered) { + currently_hovered = PanelManager::instance()->CurrentlyFocused(); + + // If no panel is hovered or focused, do nothing + if (!currently_hovered) { + return; + } } // If this panel is not actually on the main window, this is a no-op