From a9917ea94787cde9570d2cedb919b55f00583db7 Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Sun, 10 Feb 2019 14:23:28 +0900 Subject: [PATCH 1/2] SubWindow: ensure the restore button shows up correctly --- src/gui/SubWindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/SubWindow.cpp b/src/gui/SubWindow.cpp index 0a0effc4548..6c7b1e86e2c 100644 --- a/src/gui/SubWindow.cpp +++ b/src/gui/SubWindow.cpp @@ -302,8 +302,11 @@ void SubWindow::adjustTitleBar() void SubWindow::resizeEvent( QResizeEvent * event ) { - adjustTitleBar(); + // When the parent QMdiArea gets resized, maximized subwindows also gets resized, if any. + // In that case, we should call QMdiSubWindow::resizeEvent first + // to ensure we get the correct window state. QMdiSubWindow::resizeEvent( event ); + adjustTitleBar(); // if the window was resized and ISN'T minimized/maximized/fullscreen, // then save the current size From 9a635751301a6193af4bac2133212e1b2663391b Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Sun, 10 Feb 2019 14:35:45 +0900 Subject: [PATCH 2/2] Remove old workaround for the maximize behavior on Mac --- include/SubWindow.h | 1 - src/gui/SubWindow.cpp | 17 ----------------- 2 files changed, 18 deletions(-) diff --git a/include/SubWindow.h b/include/SubWindow.h index 99bd4955250..ac5a4e63c35 100644 --- a/include/SubWindow.h +++ b/include/SubWindow.h @@ -81,7 +81,6 @@ class EXPORT SubWindow : public QMdiSubWindow QGraphicsDropShadowEffect * m_shadow; static void elideText( QLabel *label, QString text ); - bool isMaximized(); void adjustTitleBar(); }; diff --git a/src/gui/SubWindow.cpp b/src/gui/SubWindow.cpp index 6c7b1e86e2c..8341024b353 100644 --- a/src/gui/SubWindow.cpp +++ b/src/gui/SubWindow.cpp @@ -148,23 +148,6 @@ void SubWindow::elideText( QLabel *label, QString text ) -bool SubWindow::isMaximized() -{ -#ifdef LMMS_BUILD_APPLE - // check if subwindow size is identical to the MdiArea size, accounting for scrollbars - int hScrollBarHeight = mdiArea()->horizontalScrollBar()->isVisible() ? mdiArea()->horizontalScrollBar()->size().height() : 0; - int vScrollBarWidth = mdiArea()->verticalScrollBar()->isVisible() ? mdiArea()->verticalScrollBar()->size().width() : 0; - QSize areaSize( this->mdiArea()->size().width() - vScrollBarWidth, this->mdiArea()->size().height() - hScrollBarHeight ); - - return areaSize == this->size(); -#else - return QMdiSubWindow::isMaximized(); -#endif -} - - - - QRect SubWindow::getTrueNormalGeometry() const { return m_trackedNormalGeom;