Move KServiceTypeTrader query for Effects into a thread
By moving the query for effects into an own thread the startup does not have to wait till all effects are loaded. The thread moves the loading of the effects after the Window Manager and Compositor has been fully initialized. This is possible as EffectsHandler is fully functional even without any effects. The compositor ensures that at least one frame is rendered before the started thread returns which makes the complete startup more responsive. REVIEW: 104583
This commit is contained in:
parent
a4f5c6f203
commit
e3f2dd7612
3 changed files with 26 additions and 3 deletions
|
@ -195,6 +195,10 @@ void Workspace::slotCompositingOptionsInitialized()
|
|||
foreach (Unmanaged * c, unmanaged)
|
||||
c->setupCompositing();
|
||||
discardPopup(); // force re-creation of the Alt+F3 popup (opacity option)
|
||||
|
||||
// render at least once
|
||||
compositeTimer.stop();
|
||||
performCompositing();
|
||||
}
|
||||
|
||||
void Workspace::finishCompositing()
|
||||
|
|
22
effects.cpp
22
effects.cpp
|
@ -36,6 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "kwinglutils.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QtCore/QFutureWatcher>
|
||||
#include <QtCore/QtConcurrentRun>
|
||||
|
||||
#include "kdebug.h"
|
||||
#include "klibrary.h"
|
||||
|
@ -165,12 +167,25 @@ void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u)
|
|||
|
||||
void EffectsHandlerImpl::reconfigure()
|
||||
{
|
||||
KSharedConfig::Ptr _config = KGlobal::config();
|
||||
KConfigGroup conf(_config, "Plugins");
|
||||
// perform querying for the services in a thread
|
||||
QFutureWatcher<KService::List> *watcher = new QFutureWatcher<KService::List>(this);
|
||||
connect(watcher, SIGNAL(finished()), this, SLOT(slotEffectsQueried()));
|
||||
watcher->setFuture(QtConcurrent::run(KServiceTypeTrader::self(), &KServiceTypeTrader::query, QString("KWin/Effect"), QString()));
|
||||
}
|
||||
|
||||
KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect");
|
||||
void EffectsHandlerImpl::slotEffectsQueried()
|
||||
{
|
||||
QFutureWatcher<KService::List> *watcher = dynamic_cast< QFutureWatcher<KService::List>* >(sender());
|
||||
if (!watcher) {
|
||||
// slot invoked not from a FutureWatcher
|
||||
return;
|
||||
}
|
||||
|
||||
KService::List offers = watcher->result();
|
||||
QStringList effectsToBeLoaded;
|
||||
QStringList checkDefault;
|
||||
KSharedConfig::Ptr _config = KGlobal::config();
|
||||
KConfigGroup conf(_config, "Plugins");
|
||||
|
||||
// First unload necessary effects
|
||||
foreach (const KService::Ptr & service, offers) {
|
||||
|
@ -202,6 +217,7 @@ void EffectsHandlerImpl::reconfigure()
|
|||
if (!newLoaded.contains(ep.first)) // don't reconfigure newly loaded effects
|
||||
ep.second->reconfigure(Effect::ReconfigureAll);
|
||||
}
|
||||
watcher->deleteLater();
|
||||
}
|
||||
|
||||
// the idea is that effects call this function again which calls the next one
|
||||
|
|
|
@ -216,6 +216,9 @@ protected:
|
|||
int next_window_quad_type;
|
||||
int mouse_poll_ref_count;
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotEffectsQueried();
|
||||
|
||||
private:
|
||||
QList< Effect* > m_activeEffects;
|
||||
QList< Effect* >::iterator m_currentDrawWindowIterator;
|
||||
|
|
Loading…
Reference in a new issue