From 4d82d2291e72c346d48585a59c7ba7612f7c53c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 9 Feb 2009 14:31:42 +0000 Subject: [PATCH] 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 --- composite.cpp | 6 ++---- events.cpp | 12 +++++++++--- workspace.cpp | 1 + workspace.h | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/composite.cpp b/composite.cpp index 36a3b3fe76..9aaeb60e66 100644 --- a/composite.cpp +++ b/composite.cpp @@ -175,10 +175,8 @@ void Workspace::setupCompositing() { // autoconfigure refresh rate based on XRandR info if( Extensions::randrAvailable() ) { - XRRScreenConfiguration *config; - - config = XRRGetScreenInfo( display(), rootWindow() ); - rate = XRRConfigCurrentRate( config ); + XRRScreenConfiguration *config = XRRGetScreenInfo( display(), rootWindow() ); + rate = xrrRefreshRate = XRRConfigCurrentRate( config ); XRRFreeScreenConfigInfo( config ); } } diff --git a/events.cpp b/events.cpp index a8764df70d..c8e99288a7 100644 --- a/events.cpp +++ b/events.cpp @@ -501,15 +501,21 @@ bool Workspace::workspaceEvent( XEvent * e ) { #ifdef HAVE_XRANDR XRRUpdateConfiguration( e ); -#endif if( compositing() ) { // desktopResized() should take care of when the size or // shape of the desktop has changed, but we also want to // catch refresh rate changes - finishCompositing(); - QTimer::singleShot( 0, this, SLOT( setupCompositing() ) ); + XRRScreenConfiguration *config = XRRGetScreenInfo( display(), rootWindow() ); + 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()) { diff --git a/workspace.cpp b/workspace.cpp index 132dcd2828..b40cddab5d 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -139,6 +139,7 @@ Workspace::Workspace( bool restore ) , cm_selection( NULL ) , compositingSuspended( false ) , compositeRate( 0 ) + , xrrRefreshRate( 0 ) , overlay( None ) , overlay_visible( true ) , overlay_shown( false ) diff --git a/workspace.h b/workspace.h index a798b00777..396b92a1c0 100644 --- a/workspace.h +++ b/workspace.h @@ -774,6 +774,7 @@ class Workspace : public QObject, public KDecorationDefines QTime nextPaintReference; QTimer mousePollingTimer; int compositeRate; + int xrrRefreshRate; // used only for compositing QRegion repaints_region; Window overlay; // XComposite overlay window bool overlay_visible;