From be55ac5c606b3e62617a10c0d00526da603ab0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 13 Apr 2012 11:27:50 +0200 Subject: [PATCH] Introduce post Workspace init phase Workspace emits a signal when the initialization finished and interested parties can connect to this signal to perform post init actions. That is everything that does not have to be performed to have a completely working Window Manager. As an example loading the scripts is moved into this post init phase. REVIEW: 104580 --- scripting/scripting.cpp | 1 + workspace.cpp | 4 +++- workspace.h | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 36b1439ad..7e3e078c5 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -252,6 +252,7 @@ KWin::Scripting::Scripting(QObject *parent) QDBusConnection::sessionBus().registerObject("/Scripting", this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables); QDBusConnection::sessionBus().registerService("org.kde.kwin.Scripting"); connect(Workspace::self(), SIGNAL(configChanged()), SLOT(start())); + connect(Workspace::self(), SIGNAL(workspaceInitialized()), SLOT(start())); } void KWin::Scripting::start() diff --git a/workspace.cpp b/workspace.cpp index 926d83be6..5e1609ac2 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -487,7 +487,6 @@ void Workspace::init() #ifdef KWIN_BUILD_SCRIPTING m_scripting = new Scripting(this); - m_scripting->start(); #endif // SELI TODO: This won't work with unreasonable focus policies, @@ -495,6 +494,9 @@ void Workspace::init() // want focus workspaceInit = false; + // broadcast that Workspace is ready, but first process all events. + QMetaObject::invokeMethod(this, "workspaceInitialized", Qt::QueuedConnection); + // TODO: ungrabXServer() } diff --git a/workspace.h b/workspace.h index 9c2d26f19..2f1547fdc 100644 --- a/workspace.h +++ b/workspace.h @@ -667,6 +667,11 @@ protected: Q_SIGNALS: Q_SCRIPTABLE void compositingToggled(bool active); + /** + * Emitted after the Workspace has setup the complete initialization process. + * This can be used to connect to for performing post-workspace initialization. + **/ + void workspaceInitialized(); //Signals required for the scripting interface signals: