Don't do any compositing when nothing is visible anyway (e.g. when switched

away from the X session).


svn path=/trunk/KDE/kdebase/workspace/; revision=726713
This commit is contained in:
Luboš Luňák 2007-10-18 17:58:08 +00:00
parent 745d101733
commit 0e55f109c5
4 changed files with 14 additions and 2 deletions

View file

@ -271,7 +271,8 @@ void Workspace::performCompositing()
if( lastCompositePaint.elapsed() < 1 ) if( lastCompositePaint.elapsed() < 1 )
return; return;
checkCursorPos(); checkCursorPos();
if( repaints_region.isEmpty() && !windowRepaintsPending()) // no damage if(( repaints_region.isEmpty() && !windowRepaintsPending()) // no damage
|| !overlay_visible ) // nothing is visible anyway
{ {
scene->idle(); scene->idle();
return; return;
@ -365,6 +366,7 @@ void Workspace::setupOverlay( Window w )
XMapWindow( display(), w ); XMapWindow( display(), w );
} }
XMapRaised( display(), overlay ); XMapRaised( display(), overlay );
XSelectInput( display(), overlay, VisibilityChangeMask );
} }
void Workspace::destroyOverlay() void Workspace::destroyOverlay()

View file

@ -455,8 +455,16 @@ bool Workspace::workspaceEvent( XEvent * e )
return true; return true;
break; break;
case Expose: case Expose:
if( e->xexpose.window == rootWindow() && compositing()) // root window needs repainting if( compositing()
&& ( e->xexpose.window == rootWindow() // root window needs repainting
|| overlay != None && e->xexpose.window == overlay )) // overlay needs repainting
{
addRepaint( e->xexpose.x, e->xexpose.y, e->xexpose.width, e->xexpose.height ); addRepaint( e->xexpose.x, e->xexpose.y, e->xexpose.width, e->xexpose.height );
}
break;
case VisibilityNotify:
if( compositing() && overlay != None && e->xvisibility.window == overlay )
overlay_visible = ( e->xvisibility.state != VisibilityFullyObscured );
break; break;
default: default:
if( e->type == Extensions::randrNotifyEvent() && Extensions::randrAvailable() ) if( e->type == Extensions::randrNotifyEvent() && Extensions::randrAvailable() )

View file

@ -128,6 +128,7 @@ Workspace::Workspace( bool restore )
cm_selection( NULL ), cm_selection( NULL ),
compositeRate( 0 ), compositeRate( 0 ),
overlay( None ), overlay( None ),
overlay_visible( true ),
transSlider( NULL ), transSlider( NULL ),
transButton( NULL ) transButton( NULL )
{ {

View file

@ -715,6 +715,7 @@ class Workspace : public QObject, public KDecorationDefines
int compositeRate; int compositeRate;
QRegion repaints_region; QRegion repaints_region;
Window overlay; // XComposite overlay window Window overlay; // XComposite overlay window
bool overlay_visible;
QSlider *transSlider; QSlider *transSlider;
QPushButton *transButton; QPushButton *transButton;