From 38291eb82c88638422f00ca897189b61379a3d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 19 Mar 2008 19:32:32 +0000 Subject: [PATCH] Make border sizes while maximizing take effect even when the actual geometry does not change. BUG: 158252 svn path=/trunk/KDE/kdebase/workspace/; revision=787741 --- client.cpp | 15 ++++++++++++--- client.h | 2 +- geometry.cpp | 30 +++++++++++++++++++++--------- workspace.cpp | 2 +- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/client.cpp b/client.cpp index dfddbb3108..75534969da 100644 --- a/client.cpp +++ b/client.cpp @@ -381,15 +381,23 @@ void Client::destroyDecoration() } } -void Client::checkBorderSizes() +bool Client::checkBorderSizes( bool also_resize ) { if( decoration == NULL ) - return; + return false; int new_left, new_right, new_top, new_bottom; decoration->borders( new_left, new_right, new_top, new_bottom ); if( new_left == border_left && new_right == border_right && new_top == border_top && new_bottom == border_bottom ) - return; + return false; + if( !also_resize ) + { + border_left = new_left; + border_right = new_right; + border_top = new_top; + border_bottom = new_bottom; + return true; + } GeometryUpdatesBlocker blocker( this ); move( calculateGravitation( true )); border_left = new_left; @@ -399,6 +407,7 @@ void Client::checkBorderSizes() move( calculateGravitation( false )); plainResize( sizeForClientSize( clientSize()), ForceGeometrySet ); checkWorkspacePosition(); + return true; } void Client::detectNoBorder() diff --git a/client.h b/client.h index 04f3bef0f6..57c7ee03d3 100644 --- a/client.h +++ b/client.h @@ -195,7 +195,7 @@ class Client QRegion mask() const; void updateDecoration( bool check_workspace_pos, bool force = false ); - void checkBorderSizes(); + bool checkBorderSizes( bool also_resize ); void updateShape(); diff --git a/geometry.cpp b/geometry.cpp index f072a46241..6246f946bc 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1942,8 +1942,12 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) Notify::raise( Notify::UnMaximize ); } + ForceGeometry_t geom_mode = NormalGeometrySet; if( decoration != NULL ) // decorations may turn off some borders when maximized - decoration->borders( border_left, border_right, border_top, border_bottom ); + { + if( checkBorderSizes( false )) // only query, don't resize + geom_mode = ForceGeometrySet; + } // restore partial maximizations if ( old_mode==MaximizeFull && max_mode==MaximizeRestore ) @@ -1969,16 +1973,20 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) { if( geom_restore.width() == 0 ) { // needs placement - plainResize( adjustedSize( QSize( width() * 2 / 3, clientArea.height()), SizemodeFixedH )); + plainResize( adjustedSize( QSize( width() * 2 / 3, clientArea.height()), SizemodeFixedH ), geom_mode ); workspace()->placeSmart( this, clientArea ); } else + { setGeometry( QRect(QPoint( geom_restore.x(), clientArea.top()), - adjustedSize(QSize( geom_restore.width(), clientArea.height()), SizemodeFixedH ))); + adjustedSize(QSize( geom_restore.width(), clientArea.height()), SizemodeFixedH )), geom_mode ); + } } else + { setGeometry( QRect(QPoint(x(), clientArea.top()), - adjustedSize(QSize(width(), clientArea.height()), SizemodeFixedH ))); + adjustedSize(QSize(width(), clientArea.height()), SizemodeFixedH )), geom_mode ); + } info->setState( NET::MaxVert, NET::Max ); break; } @@ -1989,16 +1997,20 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) { if( geom_restore.height() == 0 ) { // needs placement - plainResize( adjustedSize( QSize( clientArea.width(), height() * 2 / 3 ), SizemodeFixedW )); + plainResize( adjustedSize( QSize( clientArea.width(), height() * 2 / 3 ), SizemodeFixedW ), geom_mode ); workspace()->placeSmart( this, clientArea ); } else + { setGeometry( QRect( QPoint(clientArea.left(), geom_restore.y()), - adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizemodeFixedW ))); + adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizemodeFixedW )), geom_mode ); + } } else + { setGeometry( QRect( QPoint(clientArea.left(), y()), - adjustedSize(QSize(clientArea.width(), height()), SizemodeFixedW ))); + adjustedSize(QSize(clientArea.width(), height()), SizemodeFixedW )), geom_mode ); + } info->setState( NET::MaxHoriz, NET::Max ); break; } @@ -2032,7 +2044,7 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) if( geom_restore.height() > 0 ) restore.moveTop( geom_restore.y()); } - setGeometry( restore ); + setGeometry( restore, geom_mode ); info->setState( 0, NET::Max ); break; } @@ -2048,7 +2060,7 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) } QSize adjSize = adjustedSize(clientArea.size(), SizemodeMax ); QRect r = QRect(clientArea.topLeft(), adjSize); - setGeometry( r ); + setGeometry( r, geom_mode ); info->setState( NET::Max, NET::Max ); break; } diff --git a/workspace.cpp b/workspace.cpp index 014fd6437f..a8094e233d 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -973,7 +973,7 @@ void Workspace::slotSettingsChanged(int category) /*! Reread settings */ -KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() ); +KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes( true ) ); void Workspace::slotReconfigure() {