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;