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

View file

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

View file

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