From 53cc35b649e64fd16c63f7aac0e0e2b0dccb49b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 11 May 2008 09:48:34 +0000 Subject: [PATCH] Show the composite overlay window only before the first painting pass actually needs to flush the output to the screen. Avoids windows temporarily disappearing during KDE startup or similar visual glitches. svn path=/trunk/KDE/kdebase/workspace/; revision=806387 --- composite.cpp | 15 +++++++++++---- scene_opengl.cpp | 2 ++ scene_xrender.cpp | 2 ++ workspace.cpp | 1 + workspace.h | 2 ++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/composite.cpp b/composite.cpp index 5ffae47277..25859793da 100644 --- a/composite.cpp +++ b/composite.cpp @@ -372,14 +372,20 @@ void Workspace::setupOverlay( Window w ) assert( Extensions::shapeInputAvailable()); XShapeCombineRectangles( display(), overlay, ShapeInput, 0, 0, NULL, 0, ShapeSet, Unsorted ); if( w != None ) - { XShapeCombineRectangles( display(), w, ShapeInput, 0, 0, NULL, 0, ShapeSet, Unsorted ); - XMapWindow( display(), w ); - } - XMapRaised( display(), overlay ); XSelectInput( display(), overlay, VisibilityChangeMask ); } +void Workspace::showOverlay() + { + assert( overlay != None ); + if( overlay_shown ) + return; + XMapSubwindows( display(), overlay ); + XMapWindow( display(), overlay ); + overlay_shown = true; + } + void Workspace::destroyOverlay() { if( overlay == None ) @@ -388,6 +394,7 @@ void Workspace::destroyOverlay() XCompositeReleaseOverlayWindow( display(), overlay ); #endif overlay = None; + overlay_shown = false; } //**************************************** diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 92ec98ffd5..5e6db2324f 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -638,6 +638,8 @@ void SceneOpenGL::waitSync() // actually paint to the screen (double-buffer swap or copy from pixmap buffer) void SceneOpenGL::flushBuffer( int mask, QRegion damage ) { + if( wspace->overlayWindow()) // show the window only after the first pass, since + wspace->showOverlay(); // that pass may take long if( db ) { if( mask & PAINT_SCREEN_REGION ) diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 097155ea51..ede5d47ad4 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -170,6 +170,8 @@ void SceneXrender::paint( QRegion damage, ToplevelList toplevels ) } int mask = 0; paintScreen( &mask, &damage ); + if( wspace->overlayWindow()) // show the window only after the first pass, since + wspace->showOverlay(); // that pass may take long if( mask & PAINT_SCREEN_REGION ) { // Use the damage region as the clip region for the root window diff --git a/workspace.cpp b/workspace.cpp index b9965c2ab1..35ef19fd49 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -137,6 +137,7 @@ Workspace::Workspace( bool restore ) compositeRate( 0 ), overlay( None ), overlay_visible( true ), + overlay_shown( false ), transSlider( NULL ), transButton( NULL ) { diff --git a/workspace.h b/workspace.h index 814bb135c6..2bcbcaa19d 100644 --- a/workspace.h +++ b/workspace.h @@ -318,6 +318,7 @@ class Workspace : public QObject, public KDecorationDefines bool createOverlay(); // init overlay and the destination window in it void setupOverlay( Window window ); + void showOverlay(); // destroys XComposite overlay window void destroyOverlay(); Window overlayWindow(); @@ -723,6 +724,7 @@ class Workspace : public QObject, public KDecorationDefines QRegion repaints_region; Window overlay; // XComposite overlay window bool overlay_visible; + bool overlay_shown; // for showOverlay() QSlider *transSlider; QPushButton *transButton;