Don't needlessly setup compositing twice during startup.

Xrandr seems to like to send events about "changes" right
after application startup.


svn path=/trunk/KDE/kdebase/workspace/; revision=923829
This commit is contained in:
Luboš Luňák 2009-02-09 14:31:42 +00:00
parent 657288d7b6
commit 4d82d2291e
4 changed files with 13 additions and 7 deletions

View file

@ -175,10 +175,8 @@ void Workspace::setupCompositing()
{ // autoconfigure refresh rate based on XRandR info { // autoconfigure refresh rate based on XRandR info
if( Extensions::randrAvailable() ) if( Extensions::randrAvailable() )
{ {
XRRScreenConfiguration *config; XRRScreenConfiguration *config = XRRGetScreenInfo( display(), rootWindow() );
rate = xrrRefreshRate = XRRConfigCurrentRate( config );
config = XRRGetScreenInfo( display(), rootWindow() );
rate = XRRConfigCurrentRate( config );
XRRFreeScreenConfigInfo( config ); XRRFreeScreenConfigInfo( config );
} }
} }

View file

@ -501,15 +501,21 @@ bool Workspace::workspaceEvent( XEvent * e )
{ {
#ifdef HAVE_XRANDR #ifdef HAVE_XRANDR
XRRUpdateConfiguration( e ); XRRUpdateConfiguration( e );
#endif
if( compositing() ) if( compositing() )
{ {
// desktopResized() should take care of when the size or // desktopResized() should take care of when the size or
// shape of the desktop has changed, but we also want to // shape of the desktop has changed, but we also want to
// catch refresh rate changes // catch refresh rate changes
finishCompositing(); XRRScreenConfiguration *config = XRRGetScreenInfo( display(), rootWindow() );
QTimer::singleShot( 0, this, SLOT( setupCompositing() ) ); bool changed = ( xrrRefreshRate != XRRConfigCurrentRate( config ));
XRRFreeScreenConfigInfo( config );
if( changed )
{
finishCompositing();
QTimer::singleShot( 0, this, SLOT( setupCompositing() ) );
}
} }
#endif
} }
else if( e->type == Extensions::syncAlarmNotifyEvent() && Extensions::syncAvailable()) else if( e->type == Extensions::syncAlarmNotifyEvent() && Extensions::syncAvailable())
{ {

View file

@ -139,6 +139,7 @@ Workspace::Workspace( bool restore )
, cm_selection( NULL ) , cm_selection( NULL )
, compositingSuspended( false ) , compositingSuspended( false )
, compositeRate( 0 ) , compositeRate( 0 )
, xrrRefreshRate( 0 )
, overlay( None ) , overlay( None )
, overlay_visible( true ) , overlay_visible( true )
, overlay_shown( false ) , overlay_shown( false )

View file

@ -774,6 +774,7 @@ class Workspace : public QObject, public KDecorationDefines
QTime nextPaintReference; QTime nextPaintReference;
QTimer mousePollingTimer; QTimer mousePollingTimer;
int compositeRate; int compositeRate;
int xrrRefreshRate; // used only for compositing
QRegion repaints_region; QRegion repaints_region;
Window overlay; // XComposite overlay window Window overlay; // XComposite overlay window
bool overlay_visible; bool overlay_visible;