Make sure that the paintredirector pending region is added to the repaint region only once in case the window gets minimized.

TAB--

svn path=/trunk/KDE/kdebase/workspace/; revision=1050675
This commit is contained in:
Jacopo De Simoi 2009-11-17 21:34:58 +00:00
parent b2efc81b08
commit 637ff72e1f
3 changed files with 17 additions and 6 deletions

View file

@ -458,18 +458,18 @@ QRegion Client::decorationPendingRegion() const
{
if (!paintRedirector)
return QRegion();
return paintRedirector->pendingRegion().translated( x() - padding_left, y() - padding_top );
return paintRedirector->scheduledRepaintRegion().translated( x() - padding_left, y() - padding_top );
}
void Client::repaintDecorationPending()
{
if (compositing())
{
// The scene will update the decoration pixmaps in the next painting pass
// if it has not been already repainted before
const QRegion r = paintRedirector->pendingRegion();
if (!r.isEmpty())
Workspace::self()->addRepaint( r.translated( x() - padding_left, y() - padding_top ) );
// The scene will update the decoration pixmaps in the next painting pass
// if it has not been already repainted before
const QRegion r = paintRedirector->scheduledRepaintRegion();
if (!r.isEmpty())
Workspace::self()->addRepaint( r.translated( x() - padding_left, y() - padding_top ) );
}
else
ensureDecorationPixmapsPainted();

View file

@ -50,6 +50,7 @@ QPixmap PaintRedirector::performPendingPaint()
widget->render( &pixmap, QPoint(), pending.boundingRect(), QWidget::DrawChildren );
recursionCheck = false;
pending = QRegion();
scheduled = QRegion();
return pixmap;
}
@ -84,6 +85,7 @@ bool PaintRedirector::eventFilter( QObject* o, QEvent* e )
QPaintEvent* pe = static_cast< QPaintEvent* >( e );
QWidget* w = static_cast< QWidget* >( o );
pending |= pe->region().translated( w->mapTo( widget, QPoint( 0, 0 )));
scheduled = pending;
timer.start( 0 );
return true; // filter out
}
@ -99,6 +101,13 @@ QRegion PaintRedirector::pendingRegion() const
return pending;
}
QRegion PaintRedirector::scheduledRepaintRegion()
{
QRegion tempRegion = scheduled;
scheduled = QRegion();
return tempRegion;
}
void PaintRedirector::added( QWidget* w )
{
w->installEventFilter( this );

View file

@ -43,6 +43,7 @@ class PaintRedirector
QPixmap performPendingPaint();
virtual bool eventFilter( QObject* o, QEvent* e );
QRegion pendingRegion() const;
QRegion scheduledRepaintRegion();
signals:
void paintPending();
private:
@ -51,6 +52,7 @@ class PaintRedirector
bool isToolTip( QWidget* widget ) const;
QWidget* widget;
QRegion pending;
QRegion scheduled;
bool recursionCheck;
QTimer timer;
};