diff --git a/composite.cpp b/composite.cpp
index 2ee9e7703c..abf0e9dbbb 100644
--- a/composite.cpp
+++ b/composite.cpp
@@ -57,6 +57,8 @@ along with this program. If not, see .
#include
+#include
+#include
#include
#include
#include
@@ -90,9 +92,27 @@ void Workspace::setupCompositing()
return;
}
- if (!options->isCompositingInitialized())
+ if (!options->isCompositingInitialized()) {
+#ifndef KWIN_HAVE_OPENGLES
+ // options->reloadCompositingSettings(true) initializes the CompositingPrefs which calls an
+ // external program in turn
+ // run this in an external thread to make startup faster.
+ QFutureWatcher *compositingPrefsFuture = new QFutureWatcher();
+ connect(compositingPrefsFuture, SIGNAL(finished()), this, SLOT(slotCompositingOptionsInitialized()));
+ connect(compositingPrefsFuture, SIGNAL(finished()), compositingPrefsFuture, SLOT(deleteLater()));
+ compositingPrefsFuture->setFuture(QtConcurrent::run(options, &Options::reloadCompositingSettings, true));
+#else
+ // OpenGL ES does not call the external program, so no need to create a thread
options->reloadCompositingSettings(true);
+ slotCompositingOptionsInitialized();
+#endif
+ } else {
+ slotCompositingOptionsInitialized();
+ }
+}
+void Workspace::slotCompositingOptionsInitialized()
+{
char selection_name[ 100 ];
sprintf(selection_name, "_NET_WM_CM_S%d", DefaultScreen(display()));
cm_selection = new KSelectionOwner(selection_name);
diff --git a/workspace.h b/workspace.h
index de90110646..0447f45118 100644
--- a/workspace.h
+++ b/workspace.h
@@ -645,6 +645,10 @@ private slots:
void slotBlockShortcuts(int data);
void slotReloadConfig();
void setupCompositing();
+ /**
+ * Called from setupCompositing() when the CompositingPrefs are ready.
+ **/
+ void slotCompositingOptionsInitialized();
void finishCompositing();
void fallbackToXRenderCompositing();
void performCompositing();