From 4874785fb4887d3e29debdb079f8c630612f5c27 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Sat, 23 Jan 2010 03:41:39 +0000 Subject: [PATCH] revert r1078325 and moves the handling of Maximize state changes when un-grouping windows to clientgroup.cpp. Ensures that Client::maximize( MaximizeRestore ) is called when appropriate to avoid decoration artifacts. BUG: 223060 svn path=/trunk/KDE/kdebase/workspace/; revision=1078877 --- clientgroup.cpp | 13 ++++++++++++- geometry.cpp | 3 +-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/clientgroup.cpp b/clientgroup.cpp index 568c4cba37..e1f9aef255 100644 --- a/clientgroup.cpp +++ b/clientgroup.cpp @@ -165,8 +165,19 @@ void ClientGroup::remove( Client* c, const QRect& newGeom, bool toNullGroup ) c->setClientGroup( toNullGroup ? NULL : new ClientGroup( c )); if( newGeom.isValid() ) + { + // HACK: if the group was maximized, one needs to make some checks on the future client maximize mode + // because the transition from maximized to MaximizeRestore is not handled properly in setGeometry when + // the new geometry size is unchanged. + // since newGeom has the same size as the old client geometry, one just needs to check the topLeft position of newGeom + // and compare that to the group maximize mode. + // when the new mode is predicted to be MaximizeRestore, one must set it manually, in order to avoid decoration artifacts + Client::MaximizeMode groupMaxMode( newVisible->maximizeMode() ); + if( ( ( groupMaxMode & Client::MaximizeHorizontal ) && newGeom.left() != newVisible->geometry().left() ) || + ( ( groupMaxMode & Client::MaximizeVertical ) && newGeom.top() != newVisible->geometry().top() ) ) + c->maximize( Client::MaximizeRestore ); c->setGeometry( newGeom ); - + } newVisible->triggerDecorationRepaint(); } diff --git a/geometry.cpp b/geometry.cpp index 59bfaa8f42..801129c5e4 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2018,7 +2018,6 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) // keep track of old maximize mode // to detect changes - MaximizeMode old_mode( max_mode ); checkMaximizeGeometry(); workspace()->checkActiveScreen( this ); workspace()->updateStackingOrder(); @@ -2028,7 +2027,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) // - size is changed // - maximize mode is changed to MaximizeRestore, when size unchanged // which can happen when untabbing maximized windows - if( resized || ( old_mode != max_mode && max_mode == MaximizeRestore ) ) + if( resized ) { discardWindowPixmap(); if( scene != NULL )