Perform detection of CompositingPrefs async
Detecting CompositingPrefs invokes an external program. Waiting for this can be moved in a second thread. Due to the introduction of the thread the initialization order of KWin is changed: the WindowManager is initialized before the Compositor. Interestingly this makes KWin felt more responsive as the screen is not frozen for several seconds. REVIEW: 104579
This commit is contained in:
parent
fdd804bdf4
commit
704902720b
2 changed files with 25 additions and 1 deletions
|
@ -57,6 +57,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <QtCore/QtConcurrentRun>
|
||||
#include <QtCore/QFutureWatcher>
|
||||
#include <QMenu>
|
||||
#include <QTimerEvent>
|
||||
#include <kaction.h>
|
||||
|
@ -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<void> *compositingPrefsFuture = new QFutureWatcher<void>();
|
||||
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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue