Try to reduce damage caused by window moving.

svn path=/branches/work/kwin_composite/; revision=606266
This commit is contained in:
Luboš Luňák 2006-11-19 20:08:56 +00:00
parent 09781249b9
commit 951448b575
2 changed files with 24 additions and 18 deletions

View file

@ -492,6 +492,7 @@ class Client
QSize client_size; QSize client_size;
int block_geometry_updates; // >0 - new geometry is remembered, but not actually set int block_geometry_updates; // >0 - new geometry is remembered, but not actually set
bool pending_geometry_update; bool pending_geometry_update;
QRect geom_before_block;
bool shade_geometry_change; bool shade_geometry_change;
int border_left, border_right, border_top, border_bottom; int border_left, border_right, border_top, border_bottom;
QRegion _mask; QRegion _mask;

View file

@ -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 )) if( force == NormalGeometrySet && geom == QRect( x, y, w, h ))
return; return;
// TODO add damage only if not obscured
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
geom = QRect( x, y, w, h ); geom = QRect( x, y, w, h );
updateWorkareaDiffs(); updateWorkareaDiffs();
if( block_geometry_updates != 0 ) if( block_geometry_updates != 0 )
@ -1669,9 +1667,10 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
pending_geometry_update = true; pending_geometry_update = true;
return; return;
} }
if( geom_before_block.size() != geom.size())
{
resizeDecoration( QSize( w, h )); resizeDecoration( QSize( w, h ));
XMoveResizeWindow( display(), frameId(), x, y, w, h ); XMoveResizeWindow( display(), frameId(), x, y, w, h );
// resizeDecoration( QSize( w, h ));
if( !isShade()) if( !isShade())
{ {
QSize cs = clientSize(); QSize cs = clientSize();
@ -1681,12 +1680,18 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
} }
if( shape()) if( shape())
updateShape(); updateShape();
}
else
XMoveWindow( display(), frameId(), x, y );
// SELI TODO won't this be too expensive? // SELI TODO won't this be too expensive?
updateWorkareaDiffs(); updateWorkareaDiffs();
sendSyntheticConfigureNotify(); sendSyntheticConfigureNotify();
updateWindowRules(); updateWindowRules();
checkMaximizeGeometry(); 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 ) 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 )) if( force == NormalGeometrySet && geom.size() == QSize( w, h ))
return; return;
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
geom.setSize( QSize( w, h )); geom.setSize( QSize( w, h ));
updateWorkareaDiffs(); updateWorkareaDiffs();
if( block_geometry_updates != 0 ) if( block_geometry_updates != 0 )
@ -1742,8 +1746,9 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
sendSyntheticConfigureNotify(); sendSyntheticConfigureNotify();
updateWindowRules(); updateWindowRules();
checkMaximizeGeometry(); checkMaximizeGeometry();
// TODO add damage only in added area? addDamageFull(); // TODO add damage only in added area?
addDamageFull(); 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 )) if( force == NormalGeometrySet && geom.topLeft() == QPoint( x, y ))
return; return;
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
geom.moveTopLeft( QPoint( x, y )); geom.moveTopLeft( QPoint( x, y ));
updateWorkareaDiffs(); updateWorkareaDiffs();
if( block_geometry_updates != 0 ) if( block_geometry_updates != 0 )
@ -1766,7 +1770,8 @@ void Client::move( int x, int y, ForceGeometry_t force )
updateWindowRules(); updateWindowRules();
checkMaximizeGeometry(); checkMaximizeGeometry();
// client itself is not damaged // 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 ) void Client::blockGeometryUpdates( bool block )