From 951448b575a0ea47801b558d5eb83f09d4087c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 19 Nov 2006 20:08:56 +0000 Subject: [PATCH] Try to reduce damage caused by window moving. svn path=/branches/work/kwin_composite/; revision=606266 --- client.h | 1 + geometry.cpp | 41 +++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/client.h b/client.h index 8adf1b43b4..1692328fb6 100644 --- a/client.h +++ b/client.h @@ -492,6 +492,7 @@ class Client QSize client_size; int block_geometry_updates; // >0 - new geometry is remembered, but not actually set bool pending_geometry_update; + QRect geom_before_block; bool shade_geometry_change; int border_left, border_right, border_top, border_bottom; QRegion _mask; diff --git a/geometry.cpp b/geometry.cpp index d9e9578407..01edecddd2 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1660,8 +1660,6 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) } if( force == NormalGeometrySet && geom == QRect( x, y, w, h )) return; - // TODO add damage only if not obscured - workspace()->addDamage( geometry()); // TODO cache the previous real geometry geom = QRect( x, y, w, h ); updateWorkareaDiffs(); if( block_geometry_updates != 0 ) @@ -1669,24 +1667,31 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) pending_geometry_update = true; return; } - resizeDecoration( QSize( w, h )); - XMoveResizeWindow( display(), frameId(), x, y, w, h ); -// resizeDecoration( QSize( w, h )); - if( !isShade()) + if( geom_before_block.size() != geom.size()) { - QSize cs = clientSize(); - XMoveResizeWindow( display(), wrapperId(), clientPos().x(), clientPos().y(), - cs.width(), cs.height()); - XMoveResizeWindow( display(), window(), 0, 0, cs.width(), cs.height()); + resizeDecoration( QSize( w, h )); + XMoveResizeWindow( display(), frameId(), x, y, w, h ); + if( !isShade()) + { + QSize cs = clientSize(); + XMoveResizeWindow( display(), wrapperId(), clientPos().x(), clientPos().y(), + cs.width(), cs.height()); + XMoveResizeWindow( display(), window(), 0, 0, cs.width(), cs.height()); + } + if( shape()) + updateShape(); } - if( shape()) - updateShape(); + else + XMoveWindow( display(), frameId(), x, y ); // SELI TODO won't this be too expensive? updateWorkareaDiffs(); sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); - addDamageFull(); + if( geom_before_block.size() != geom.size()) + addDamageFull(); // damage window only if it actually was a resize + workspace()->addDamage( geom_before_block ); // TODO add damage only if not obscured + geom_before_block = geom; } void Client::plainResize( int w, int h, ForceGeometry_t force ) @@ -1718,7 +1723,6 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) } if( force == NormalGeometrySet && geom.size() == QSize( w, h )) return; - workspace()->addDamage( geometry()); // TODO cache the previous real geometry geom.setSize( QSize( w, h )); updateWorkareaDiffs(); if( block_geometry_updates != 0 ) @@ -1742,8 +1746,9 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); - // TODO add damage only in added area? - addDamageFull(); + addDamageFull(); // TODO add damage only in added area? + workspace()->addDamage( geom_before_block ); // TODO add damage only if not obscured + geom_before_block = geom; } /*! @@ -1753,7 +1758,6 @@ void Client::move( int x, int y, ForceGeometry_t force ) { if( force == NormalGeometrySet && geom.topLeft() == QPoint( x, y )) return; - workspace()->addDamage( geometry()); // TODO cache the previous real geometry geom.moveTopLeft( QPoint( x, y )); updateWorkareaDiffs(); if( block_geometry_updates != 0 ) @@ -1766,7 +1770,8 @@ void Client::move( int x, int y, ForceGeometry_t force ) updateWindowRules(); checkMaximizeGeometry(); // client itself is not damaged - workspace()->addDamage( geometry()); + workspace()->addDamage( geom_before_block ); // TODO add damage only if not obscured + geom_before_block = geom; } void Client::blockGeometryUpdates( bool block )