From 3685b3260a250e274d74e7b0c726bedfd1b28173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Thu, 11 Jun 2009 20:12:11 +0000 Subject: [PATCH] Make sure that the repainted area includes the whole area used by the decoration. This fixes ghost shadows being left behind when windows are minimized. svn path=/trunk/KDE/kdebase/workspace/; revision=980474 --- client.cpp | 12 ++++++------ client.h | 6 ++++++ toplevel.cpp | 5 +++++ toplevel.h | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client.cpp b/client.cpp index 949ee41654..1a7f24a283 100644 --- a/client.cpp +++ b/client.cpp @@ -218,7 +218,7 @@ void Client::releaseWindow( bool on_shutdown ) finishWindowRules(); ++block_geometry_updates; if( isOnCurrentDesktop() && isShown( true )) - addWorkspaceRepaint( geometry()); + addWorkspaceRepaint( visibleRect() ); // Grab X during the release to make removing of properties, setting to withdrawn state // and repareting to root an atomic operation (http://lists.kde.org/?l=kde-devel&m=116448102901184&w=2) grabXServer(); @@ -286,7 +286,7 @@ void Client::destroyClient() finishWindowRules(); ++block_geometry_updates; if( isOnCurrentDesktop() && isShown( true )) - addWorkspaceRepaint( geometry()); + addWorkspaceRepaint( visibleRect() ); setModal( false ); hidden = true; // So that it's not considered visible anymore workspace()->clientHidden( this ); @@ -669,7 +669,7 @@ void Client::updateShape() if( compositing()) { addRepaintFull(); - addWorkspaceRepaint( geometry()); // In case shape change removes part of this window + addWorkspaceRepaint( visibleRect() ); // In case shape change removes part of this window } if( scene != NULL ) scene->windowGeometryShapeChanged( this ); @@ -903,7 +903,7 @@ void Client::setShade( ShadeMode mode ) // TODO: All this unmapping, resizing etc. feels too much duplicated from elsewhere if ( isShade()) { // shade_mode == ShadeNormal - addWorkspaceRepaint( geometry() ); + addWorkspaceRepaint( visibleRect() ); // Shade shade_geometry_change = true; QSize s( sizeForClientSize( QSize( clientSize() ))); @@ -1061,7 +1061,7 @@ void Client::internalHide( allowed_t ) unmap( Allowed ); if( old == Kept ) updateHiddenPreview(); - addWorkspaceRepaint( geometry() ); + addWorkspaceRepaint( visibleRect() ); workspace()->clientHidden( this ); workspace()->checkUnredirect(); } @@ -1076,7 +1076,7 @@ void Client::internalKeep( allowed_t ) if( old == Unmapped || old == Withdrawn ) map( Allowed ); updateHiddenPreview(); - addWorkspaceRepaint( geometry() ); + addWorkspaceRepaint( visibleRect() ); workspace()->clientHidden( this ); workspace()->checkUnredirect(); } diff --git a/client.h b/client.h index 6be895ea18..a729aa9004 100644 --- a/client.h +++ b/client.h @@ -104,6 +104,7 @@ class Client QSize maxSize() const; virtual QPoint clientPos() const; // Inside of geometry() virtual QSize clientSize() const; + virtual QRect visibleRect() const; bool windowEvent( XEvent* e ); virtual bool eventFilter( QObject* o, QEvent* e ); @@ -785,6 +786,11 @@ inline QSize Client::clientSize() const return client_size; } +inline QRect Client::visibleRect() const + { + return geometry().adjusted( -padding_left, -padding_top, padding_right, padding_bottom ); + } + inline void Client::setGeometry( const QRect& r, ForceGeometry_t force ) { setGeometry( r.x(), r.y(), r.width(), r.height(), force ); diff --git a/toplevel.cpp b/toplevel.cpp index ebe9242a16..25b9d0bb52 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -142,6 +142,11 @@ void Toplevel::disownDataPassedToDeleted() info = NULL; } +QRect Toplevel::visibleRect() const + { + return geometry(); + } + NET::WindowType Toplevel::windowType( bool direct, int supported_types ) const { if( supported_types == 0 ) diff --git a/toplevel.h b/toplevel.h index f0cdfb0441..b075f7bd88 100644 --- a/toplevel.h +++ b/toplevel.h @@ -64,6 +64,7 @@ class Toplevel int screen() const; // the screen where the center is virtual QPoint clientPos() const = 0; // inside of geometry() virtual QSize clientSize() const = 0; + virtual QRect visibleRect() const; // the area the window occupies on the screen // prefer isXXX() instead // 0 for supported types means default for managed/unmanaged types