From f8163eac9dd287199c966d8a96625da9e031508e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 23 Sep 2008 15:22:25 +0000 Subject: [PATCH] Use setOverlayShape() instead of doing it manually. svn path=/trunk/KDE/kdebase/workspace/; revision=863939 --- composite.cpp | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/composite.cpp b/composite.cpp index 6ca0edc453..877f986963 100644 --- a/composite.cpp +++ b/composite.cpp @@ -479,6 +479,7 @@ void Workspace::setupOverlay( Window w ) assert( overlay != None ); assert( Extensions::shapeInputAvailable()); XSetWindowBackgroundPixmap( display(), overlay, None ); + overlay_shape = QRegion(); setOverlayShape( QRect( 0, 0, displayWidth(), displayHeight())); if( w != None ) { @@ -508,6 +509,10 @@ void Workspace::hideOverlay() void Workspace::setOverlayShape( const QRegion& reg ) { + // Avoid setting the same shape again, it causes flicker (apparently it is not a no-op + // and triggers something). + if( reg == overlay_shape ) + return; QVector< QRect > rects = reg.rects(); XRectangle* xrects = new XRectangle[ rects.count() ]; for( int i = 0; @@ -584,25 +589,7 @@ void Workspace::delayedCheckUnredirect() if( c->unredirected()) reg -= c->geometry(); } - // Avoid setting the same shape again, it causes flicker (apparently it is not a no-op - // and triggers something). - if( reg == overlay_shape ) - return; - overlay_shape = reg; - QVector< QRect > rects = reg.rects(); - XRectangle* xrects = new XRectangle[ rects.count() ]; - for( int i = 0; - i < rects.count(); - ++i ) - { - xrects[ i ].x = rects[ i ].x(); - xrects[ i ].y = rects[ i ].y(); - xrects[ i ].width = rects[ i ].width(); - xrects[ i ].height = rects[ i ].height(); - } - XShapeCombineRectangles( display(), overlay, ShapeBounding, 0, 0, - xrects, rects.count(), ShapeSet, Unsorted ); - delete[] xrects; + setOverlayShape( reg ); } //****************************************