From ef59c8956a11a2d07c612bb5f0ff8924db0d10b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 19 Jun 2007 15:40:09 +0000 Subject: [PATCH] When doing a forced geometry update while updates are suspended, remember to force the geometry update when resuming. svn path=/trunk/KDE/kdebase/workspace/; revision=677635 --- client.cpp | 2 +- client.h | 3 ++- geometry.cpp | 46 ++++++++++++++++++++++++++++++++-------------- manage.cpp | 2 +- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/client.cpp b/client.cpp index dcb9cd9f48..5dac1d7159 100644 --- a/client.cpp +++ b/client.cpp @@ -89,7 +89,7 @@ Client::Client( Workspace *ws ) user_time( CurrentTime ), // not known yet allowed_actions( 0 ), block_geometry_updates( 0 ), - pending_geometry_update( false ), + pending_geometry_update( PendingGeometryNone ), shade_geometry_change( false ), border_left( 0 ), border_right( 0 ), diff --git a/client.h b/client.h index eddd391ef2..284867770b 100644 --- a/client.h +++ b/client.h @@ -461,7 +461,8 @@ class Client unsigned long allowed_actions; QSize client_size; int block_geometry_updates; // >0 - new geometry is remembered, but not actually set - bool pending_geometry_update; + enum PendingGeometry_t { PendingGeometryNone, PendingGeometryNormal, PendingGeometryForced }; + PendingGeometry_t pending_geometry_update; QRect geom_before_block; bool shade_geometry_change; int border_left, border_right, border_top, border_bottom; diff --git a/geometry.cpp b/geometry.cpp index 1f2da78d52..9520347b66 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1677,16 +1677,21 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) { client_size = QSize( w - border_left - border_right, h - border_top - border_bottom ); } - if( force == NormalGeometrySet && geom == QRect( x, y, w, h )) + if( force == NormalGeometrySet && geom == QRect( x, y, w, h ) && pending_geometry_update == PendingGeometryNone ) return; geom = QRect( x, y, w, h ); - updateWorkareaDiffs(); if( block_geometry_updates != 0 ) { - pending_geometry_update = true; + if( pending_geometry_update == PendingGeometryForced ) + {} // maximum, nothing needed + else if( force == ForceGeometrySet ) + pending_geometry_update = PendingGeometryForced; + else + pending_geometry_update = PendingGeometryNormal; return; } - if( geom_before_block.size() != geom.size()) + bool resized = ( geom_before_block.size() != geom.size() || pending_geometry_update == PendingGeometryForced ); + if( resized ) { resizeDecoration( QSize( w, h )); XMoveResizeWindow( display(), frameId(), x, y, w, h ); @@ -1708,7 +1713,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) updateWindowRules(); checkMaximizeGeometry(); workspace()->checkActiveScreen( this ); - if( geom_before_block.size() != geom.size()) + if( resized ) { discardWindowPixmap(); if( scene != NULL ) @@ -1747,13 +1752,19 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) kDebug() << "forced size fail:" << QSize( w,h ) << ":" << rules()->checkSize( QSize( w, h )) << endl; kDebug() << kBacktrace() << endl; } + // resuming geometry updates is handled only in setGeometry() + assert( pending_geometry_update == PendingGeometryNone || block_geometry_updates > 0 ); if( force == NormalGeometrySet && geom.size() == QSize( w, h )) return; geom.setSize( QSize( w, h )); - updateWorkareaDiffs(); if( block_geometry_updates != 0 ) { - pending_geometry_update = true; + if( pending_geometry_update == PendingGeometryForced ) + {} // maximum, nothing needed + else if( force == ForceGeometrySet ) + pending_geometry_update = PendingGeometryForced; + else + pending_geometry_update = PendingGeometryNormal; return; } resizeDecoration( QSize( w, h )); @@ -1786,16 +1797,23 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) */ void Client::move( int x, int y, ForceGeometry_t force ) { + // resuming geometry updates is handled only in setGeometry() + assert( pending_geometry_update == PendingGeometryNone || block_geometry_updates > 0 ); if( force == NormalGeometrySet && geom.topLeft() == QPoint( x, y )) return; geom.moveTopLeft( QPoint( x, y )); - updateWorkareaDiffs(); if( block_geometry_updates != 0 ) { - pending_geometry_update = true; + if( pending_geometry_update == PendingGeometryForced ) + {} // maximum, nothing needed + else if( force == ForceGeometrySet ) + pending_geometry_update = PendingGeometryForced; + else + pending_geometry_update = PendingGeometryNormal; return; } XMoveWindow( display(), frameId(), x, y ); + updateWorkareaDiffs(); sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); @@ -1811,20 +1829,20 @@ void Client::blockGeometryUpdates( bool block ) if( block ) { if( block_geometry_updates == 0 ) - pending_geometry_update = false; + pending_geometry_update = PendingGeometryNone; ++block_geometry_updates; } else { if( --block_geometry_updates == 0 ) { - if( pending_geometry_update ) + if( pending_geometry_update != PendingGeometryNone ) { if( isShade()) - setGeometry( QRect( pos(), adjustedSize()), ForceGeometrySet ); + setGeometry( QRect( pos(), adjustedSize()), NormalGeometrySet ); else - setGeometry( geometry(), ForceGeometrySet ); - pending_geometry_update = false; + setGeometry( geometry(), NormalGeometrySet ); + pending_geometry_update = PendingGeometryNone; } } } diff --git a/manage.cpp b/manage.cpp index 3f49132e8d..c5eb80e98b 100644 --- a/manage.cpp +++ b/manage.cpp @@ -49,7 +49,7 @@ bool Client::manage( Window w, bool isMapped ) // from this place on, manage() mustn't return false block_geometry_updates = 1; - pending_geometry_update = true; // force update when finishing with geometry changes + pending_geometry_update = PendingGeometryForced; // force update when finishing with geometry changes embedClient( w, attr );