Avoids a nasty race condition that caused corrupted window decorations

BUG:199735


svn path=/trunk/KDE/kdebase/workspace/; revision=1046461
This commit is contained in:
Jacopo De Simoi 2009-11-08 19:47:58 +00:00
parent 8b3cb14094
commit 71a73acae8
4 changed files with 17 additions and 7 deletions

View file

@ -449,15 +449,16 @@ void Client::layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect
padding_right + border_right, r.height() - top.height() - bottom.height());
}
QRegion Client::decorationPendingRegion() const
{
if (!paintRedirector)
return QRegion();
return paintRedirector->pendingRegion().translated( x() - padding_left, y() - padding_top );
}
void Client::repaintDecorationPending()
{
if ( compositing() )
{
// The scene will update the decoration pixmaps in the next painting pass
const QRegion r = paintRedirector->pendingRegion();
Workspace::self()->addRepaint( r.translated( x() - padding_left, y() - padding_top ) );
}
else
if (!compositing())
ensureDecorationPixmapsPainted();
}

View file

@ -336,6 +336,8 @@ class Client
QRect(0, 0, width(), height());
}
QRegion decorationPendingRegion() const;
enum CoordinateMode {
DecorationRelative, // Relative to the top left corner of the decoration
WindowRelative // Relative to the top left corner of the window

View file

@ -414,6 +414,7 @@ void Workspace::performCompositing()
// TODO I think effects->transformWindowDamage() doesn't need to be called here,
// pre-paint will extend painted window areas as necessary.
repaints_region |= c->repaints().translated( c->pos());
repaints_region |= c->decorationPendingRegion();
c->resetRepaints( c->decorationRect());
}
QRegion repaints = repaints_region;

View file

@ -66,6 +66,7 @@ class Toplevel
virtual QSize clientSize() const = 0;
virtual QRect visibleRect() const; // the area the window occupies on the screen
virtual QRect decorationRect() const; // rect including the decoration shadows
virtual QRegion decorationPendingRegion() const; // decoration region that needs to be repainted
// prefer isXXX() instead
// 0 for supported types means default for managed/unmanaged types
@ -251,6 +252,11 @@ inline QRect Toplevel::decorationRect() const
return rect();
}
inline QRegion Toplevel::decorationPendingRegion() const
{
return QRegion();
}
inline bool Toplevel::readyForPainting() const
{
return ready_for_painting;