Don't bother with trying to transform window damage,
when there are any transformations, it should simply repaint everything (todo). svn path=/branches/work/kwin_composite/; revision=593450icc-effect-5.14.5
parent
e194246f73
commit
06203d0652
|
@ -117,22 +117,6 @@ void Workspace::addDamage( const QRect& r )
|
||||||
damage_region += r;
|
damage_region += r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::addDamage( Toplevel* c, int x, int y, int w, int h )
|
|
||||||
{
|
|
||||||
if( !compositing())
|
|
||||||
return;
|
|
||||||
addDamage( c, QRect( x, y, w, h ));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::addDamage( Toplevel* c, const QRect& r )
|
|
||||||
{
|
|
||||||
if( !compositing())
|
|
||||||
return;
|
|
||||||
QRegion r2( r );
|
|
||||||
scene->transformWindowDamage( c, r2 );
|
|
||||||
damage_region += r2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::compositeTimeout()
|
void Workspace::compositeTimeout()
|
||||||
{
|
{
|
||||||
if( damage_region.isEmpty()) // no damage
|
if( damage_region.isEmpty()) // no damage
|
||||||
|
@ -222,7 +206,7 @@ void Toplevel::addDamage( int x, int y, int w, int h )
|
||||||
// this could be possibly optimized to damage Workspace only if the toplevel
|
// this could be possibly optimized to damage Workspace only if the toplevel
|
||||||
// is actually visible there and not obscured by something, but I guess
|
// is actually visible there and not obscured by something, but I guess
|
||||||
// that's not really worth it
|
// that's not really worth it
|
||||||
workspace()->addDamage( this, r );
|
workspace()->addDamage( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toplevel::resetDamage()
|
void Toplevel::resetDamage()
|
||||||
|
|
13
effects.cpp
13
effects.cpp
|
@ -188,8 +188,8 @@ void ShakyMove::windowUserMovedResized( Toplevel* c, bool first, bool last )
|
||||||
else if( last )
|
else if( last )
|
||||||
{
|
{
|
||||||
windows.remove( c );
|
windows.remove( c );
|
||||||
scene->updateTransformation( c );
|
// TODO just damage whole screen, transformation is involved
|
||||||
c->workspace()->addDamage( c, c->geometry().adjusted( -3, 7, 0, 0 ));
|
c->workspace()->addDamage( c->geometry().adjusted( -3, 7, 0, 0 ));
|
||||||
if( windows.isEmpty())
|
if( windows.isEmpty())
|
||||||
timer.stop();
|
timer.stop();
|
||||||
}
|
}
|
||||||
|
@ -212,8 +212,8 @@ void ShakyMove::tick()
|
||||||
*it = 0;
|
*it = 0;
|
||||||
else
|
else
|
||||||
++(*it);
|
++(*it);
|
||||||
scene->updateTransformation( it.key());
|
// TODO damage whole screen, transformation is involved
|
||||||
it.key()->workspace()->addDamage( it.key(), it.key()->geometry().adjusted( -1, 2, 0, 0 ));
|
it.key()->workspace()->addDamage( it.key()->geometry().adjusted( -1, 2, 0, 0 ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,9 +233,8 @@ void GrowMove::windowUserMovedResized( Toplevel* c, bool first, bool last )
|
||||||
{
|
{
|
||||||
if( first || last )
|
if( first || last )
|
||||||
{
|
{
|
||||||
c->workspace()->addDamage( c, c->geometry());
|
// TODO damage whole screen, transformation is involved
|
||||||
scene->updateTransformation( c );
|
c->workspace()->addDamage( c->geometry());
|
||||||
c->workspace()->addDamage( c, c->geometry());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1655,7 +1655,7 @@ void Unmanaged::configureNotifyEvent( XConfigureEvent* e )
|
||||||
{
|
{
|
||||||
resetWindowPixmap();
|
resetWindowPixmap();
|
||||||
// TODO add damage only if the window is not obscured
|
// TODO add damage only if the window is not obscured
|
||||||
workspace()->addDamage( this, geometry());
|
workspace()->addDamage( geometry());
|
||||||
geom = QRect( e->x, e->y, e->width, e->height );
|
geom = QRect( e->x, e->y, e->width, e->height );
|
||||||
// TODO maybe only damage changed area
|
// TODO maybe only damage changed area
|
||||||
addDamage( rect());
|
addDamage( rect());
|
||||||
|
|
|
@ -1661,7 +1661,7 @@ 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
|
// TODO add damage only if not obscured
|
||||||
workspace()->addDamage( this, geometry()); // TODO cache the previous real geometry
|
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
|
||||||
geom = QRect( x, y, w, h );
|
geom = QRect( x, y, w, h );
|
||||||
updateWorkareaDiffs();
|
updateWorkareaDiffs();
|
||||||
if( postpone_geometry_updates != 0 )
|
if( postpone_geometry_updates != 0 )
|
||||||
|
@ -1719,7 +1719,7 @@ 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( this, geometry()); // TODO cache the previous real geometry
|
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
|
||||||
geom.setSize( QSize( w, h ));
|
geom.setSize( QSize( w, h ));
|
||||||
updateWorkareaDiffs();
|
updateWorkareaDiffs();
|
||||||
if( postpone_geometry_updates != 0 )
|
if( postpone_geometry_updates != 0 )
|
||||||
|
@ -1755,7 +1755,7 @@ 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( this, geometry()); // TODO cache the previous real geometry
|
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
|
||||||
geom.moveTopLeft( QPoint( x, y ));
|
geom.moveTopLeft( QPoint( x, y ));
|
||||||
updateWorkareaDiffs();
|
updateWorkareaDiffs();
|
||||||
if( postpone_geometry_updates != 0 )
|
if( postpone_geometry_updates != 0 )
|
||||||
|
@ -1768,7 +1768,7 @@ 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( this, geometry());
|
workspace()->addDamage( geometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::postponeGeometryUpdates( bool postpone )
|
void Client::postponeGeometryUpdates( bool postpone )
|
||||||
|
|
|
@ -42,14 +42,6 @@ void Scene::windowDeleted( Toplevel* )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::transformWindowDamage( Toplevel*, QRegion& ) const
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene::updateTransformation( Toplevel* )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Scene* scene;
|
Scene* scene;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
8
scene.h
8
scene.h
|
@ -22,7 +22,7 @@ class Scene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Scene( Workspace* ws );
|
Scene( Workspace* ws );
|
||||||
virtual ~Scene();
|
virtual ~Scene() = 0;
|
||||||
// repaints the given screen areas, windows provides the stacking order
|
// repaints the given screen areas, windows provides the stacking order
|
||||||
virtual void paint( QRegion damage, ToplevelList windows ) = 0;
|
virtual void paint( QRegion damage, ToplevelList windows ) = 0;
|
||||||
// shape/size of a window changed
|
// shape/size of a window changed
|
||||||
|
@ -33,12 +33,6 @@ class Scene
|
||||||
virtual void windowAdded( Toplevel* );
|
virtual void windowAdded( Toplevel* );
|
||||||
// a window has been destroyed
|
// a window has been destroyed
|
||||||
virtual void windowDeleted( Toplevel* );
|
virtual void windowDeleted( Toplevel* );
|
||||||
// transforms the window areas to screen areas
|
|
||||||
virtual void transformWindowDamage( Toplevel*, QRegion& ) const;
|
|
||||||
// updates cached window information after an effect changes
|
|
||||||
// transformation
|
|
||||||
// TODO - remove?
|
|
||||||
virtual void updateTransformation( Toplevel* );
|
|
||||||
protected:
|
protected:
|
||||||
Workspace* wspace;
|
Workspace* wspace;
|
||||||
};
|
};
|
||||||
|
|
|
@ -195,13 +195,6 @@ void SceneOpenGL::windowOpacityChanged( Toplevel* )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneOpenGL::updateTransformation( Toplevel* )
|
|
||||||
{
|
|
||||||
// TODO this is only used in effects to later update
|
|
||||||
// screen damage - since opengl doesn't use screen
|
|
||||||
// damage, just leave this empty
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneOpenGL::Window::Window( Toplevel* c )
|
SceneOpenGL::Window::Window( Toplevel* c )
|
||||||
: toplevel( c )
|
: toplevel( c )
|
||||||
, texture( 0 )
|
, texture( 0 )
|
||||||
|
|
|
@ -31,9 +31,6 @@ class SceneOpenGL
|
||||||
virtual void windowOpacityChanged( Toplevel* );
|
virtual void windowOpacityChanged( Toplevel* );
|
||||||
virtual void windowAdded( Toplevel* );
|
virtual void windowAdded( Toplevel* );
|
||||||
virtual void windowDeleted( Toplevel* );
|
virtual void windowDeleted( Toplevel* );
|
||||||
// screen damage is not used with opengl, it's completely repainted
|
|
||||||
// virtual void transformWindowDamage( Toplevel*, QRegion& ) const;
|
|
||||||
virtual void updateTransformation( Toplevel* );
|
|
||||||
private:
|
private:
|
||||||
typedef GLuint Texture;
|
typedef GLuint Texture;
|
||||||
GC gcroot;
|
GC gcroot;
|
||||||
|
|
|
@ -181,33 +181,6 @@ void SceneXrender::paint( QRegion dam, ToplevelList windows )
|
||||||
XFixesDestroyRegion( display(), damage );
|
XFixesDestroyRegion( display(), damage );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneXrender::transformWindowDamage( Toplevel* c, QRegion& r ) const
|
|
||||||
{
|
|
||||||
if( !window_data.contains( c ))
|
|
||||||
return;
|
|
||||||
const Matrix& matrix = window_data[ c ].matrix;
|
|
||||||
if( matrix.isIdentity())
|
|
||||||
return;
|
|
||||||
if( matrix.isOnlyTranslate())
|
|
||||||
r.translate( int( matrix.xTranslate()), int( matrix.yTranslate()));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The region here should be translated using the matrix, but that's not possible
|
|
||||||
// (well, maybe fetch the region and transform manually - TODO check). So simply
|
|
||||||
// mark whole screen as damaged.
|
|
||||||
r = QRegion( 0, 0, displayWidth(), displayHeight());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneXrender::updateTransformation( Toplevel* c )
|
|
||||||
{
|
|
||||||
// TODO maybe only mark as invalid and update on-demand
|
|
||||||
resetWindowData( c );
|
|
||||||
WindowData& data = window_data[ c ];
|
|
||||||
effects->transformWindow( c, data.matrix, data.effect );
|
|
||||||
effects->transformWorkspace( data.matrix, data.effect );
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneXrender::resetWindowData( Toplevel* c )
|
void SceneXrender::resetWindowData( Toplevel* c )
|
||||||
{
|
{
|
||||||
if( !window_data.contains( c ))
|
if( !window_data.contains( c ))
|
||||||
|
|
|
@ -35,8 +35,6 @@ class SceneXrender
|
||||||
virtual void windowOpacityChanged( Toplevel* );
|
virtual void windowOpacityChanged( Toplevel* );
|
||||||
virtual void windowAdded( Toplevel* );
|
virtual void windowAdded( Toplevel* );
|
||||||
virtual void windowDeleted( Toplevel* );
|
virtual void windowDeleted( Toplevel* );
|
||||||
virtual void transformWindowDamage( Toplevel*, QRegion& ) const;
|
|
||||||
virtual void updateTransformation( Toplevel* );
|
|
||||||
private:
|
private:
|
||||||
void createBuffer();
|
void createBuffer();
|
||||||
void resetWindowData( Toplevel* c );
|
void resetWindowData( Toplevel* c );
|
||||||
|
|
|
@ -285,10 +285,6 @@ class Workspace : public QObject, public KDecorationDefines
|
||||||
|
|
||||||
void addDamage( const QRect& r );
|
void addDamage( const QRect& r );
|
||||||
void addDamage( int x, int y, int w, int h );
|
void addDamage( int x, int y, int w, int h );
|
||||||
// these damage the workspace without actually damaging the contents
|
|
||||||
// of the toplevel - e.g. when the toplevel moves away from that area
|
|
||||||
void addDamage( Toplevel* c, const QRect& r );
|
|
||||||
void addDamage( Toplevel* c, int x, int y, int w, int h );
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
Loading…
Reference in New Issue