diff --git a/client.cpp b/client.cpp index c60f46b8f1..4a83290867 100644 --- a/client.cpp +++ b/client.cpp @@ -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(); diff --git a/paintredirector.cpp b/paintredirector.cpp index 20c481f1e5..dcea50af15 100644 --- a/paintredirector.cpp +++ b/paintredirector.cpp @@ -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 ); diff --git a/paintredirector.h b/paintredirector.h index 5ce978064d..ce11daa457 100644 --- a/paintredirector.h +++ b/paintredirector.h @@ -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; };