diff --git a/client.h b/client.h index 4b40ac02eb..6c2b6e2474 100644 --- a/client.h +++ b/client.h @@ -127,6 +127,7 @@ class Client : public QObject, public KDecorationDefines bool isMinimized() const; bool isMaximizable() const; QRect geometryRestore() const; + MaximizeMode maximizeModeRestore() const; MaximizeMode maximizeMode() const; bool isMinimizable() const; void setMaximize( bool vertically, bool horizontally ); @@ -501,6 +502,7 @@ class Client : public QObject, public KDecorationDefines MaximizeMode max_mode; QRect geom_restore; QRect geom_fs_restore; + MaximizeMode maxmode_restore; int workarea_diff_x, workarea_diff_y; WinInfo* info; QTimer* autoRaiseTimer; @@ -722,6 +724,11 @@ inline QRect Client::geometryRestore() const return geom_restore; } +inline Client::MaximizeMode Client::maximizeModeRestore() const + { + return maxmode_restore; + } + inline Client::MaximizeMode Client::maximizeMode() const { return max_mode; diff --git a/geometry.cpp b/geometry.cpp index b4cc415ed2..b5472491ef 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1838,6 +1838,21 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) if( decoration != NULL ) // decorations may turn off some borders when maximized decoration->borders( border_left, border_right, border_top, border_bottom ); + // restore partial maximizations + if ( old_mode==MaximizeFull && max_mode==MaximizeRestore ) + { + if ( maximizeModeRestore()==MaximizeVertical ) + { + max_mode = MaximizeVertical; + maxmode_restore = MaximizeRestore; + } + if ( maximizeModeRestore()==MaximizeHorizontal ) + { + max_mode = MaximizeHorizontal; + maxmode_restore = MaximizeRestore; + } + } + switch (max_mode) { @@ -1917,6 +1932,10 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) case MaximizeFull: { + if( old_mode & MaximizeVertical ) + maxmode_restore = MaximizeVertical; + if( old_mode & MaximizeHorizontal ) + maxmode_restore = MaximizeHorizontal; QSize adjSize = adjustedSize(clientArea.size(), SizemodeMax ); QRect r = QRect(clientArea.topLeft(), adjSize); setGeometry( r );