From 6ed208596c5df815041864202b896eb993b32d03 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Fri, 23 Jun 2000 18:18:34 +0000 Subject: [PATCH] propagate the state (for example maximize) as required svn path=/trunk/kdebase/kwin/; revision=54137 --- client.cpp | 66 ++++++++++++++++++++++++++++++------------------------ client.h | 2 +- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/client.cpp b/client.cpp index 9d65be1f79..b21dbbf8c2 100644 --- a/client.cpp +++ b/client.cpp @@ -63,12 +63,14 @@ public: m_client->setShade( state & NET::Shaded ); if ( mask & NET::Max ) { - if ( state & NET::Max == NET::Max ) + if ( (state & NET::Max) == NET::Max ) m_client->maximize( Client::MaximizeFull ); else if ( state & NET::MaxVert ) m_client->maximize( Client::MaximizeVertical ); else if ( state & NET::MaxHoriz ) m_client->maximize( Client::MaximizeHorizontal ); + else + m_client->maximize( Client::MaximizeRestore ); } } private: @@ -1397,45 +1399,51 @@ void Client::maximize( MaximizeMode m) if (isShade()) setShade( FALSE ); - if (geom_restore.isNull()) { - + if ( !geom_restore.isNull() ) + m = MaximizeRestore; + + if ( m != MaximizeRestore ) { Events::raise( Events::Maximize ); geom_restore = geometry(); + } - switch (m) { + switch (m) { - case MaximizeVertical: - setGeometry( - QRect(QPoint(x(), clientArea.top()), - adjustedSize(QSize(width(), clientArea.height()))) - ); - break; + case MaximizeVertical: + setGeometry( + QRect(QPoint(x(), clientArea.top()), + adjustedSize(QSize(width(), clientArea.height()))) + ); + info->setState( NET::MaxVert, NET::MaxVert ); + break; - case MaximizeHorizontal: + case MaximizeHorizontal: - setGeometry( - QRect( - QPoint(clientArea.left(), y()), - adjustedSize(QSize(clientArea.width(), height()))) - ); - break; - - default: - - setGeometry( - QRect(clientArea.topLeft(), adjustedSize(clientArea.size())) - ); - } - - maximizeChange(true); - - } else { + setGeometry( + QRect( + QPoint(clientArea.left(), y()), + adjustedSize(QSize(clientArea.width(), height()))) + ); + info->setState( NET::MaxHoriz, NET::MaxHoriz ); + break; + + case MaximizeRestore: { Events::raise( Events::UnMaximize ); setGeometry(geom_restore); QRect invalid; geom_restore = invalid; - maximizeChange(false); + info->setState( 0, NET::Max ); + } break; + + case MaximizeFull: + + setGeometry( + QRect(clientArea.topLeft(), adjustedSize(clientArea.size())) + ); + info->setState( NET::Max, NET::Max ); } + + maximizeChange( m != MaximizeRestore ); } diff --git a/client.h b/client.h index 1bed5a206b..944a89e969 100644 --- a/client.h +++ b/client.h @@ -112,7 +112,7 @@ public: virtual void setShade( bool ); bool isMaximized() const; - enum MaximizeMode { MaximizeVertical, MaximizeHorizontal, MaximizeFull }; + enum MaximizeMode { MaximizeVertical, MaximizeHorizontal, MaximizeFull, MaximizeRestore }; bool isSticky() const; void setSticky( bool );