Don't check for waylandServer() when accessing the platform in Compositor

Summary: Less diversions between X11 and Wayland.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1415
This commit is contained in:
Martin Gräßlin 2016-04-15 11:19:12 +02:00
parent e4c333a372
commit 4ef07494bd

View file

@ -115,32 +115,29 @@ Compositor::Compositor(QObject* workspace)
m_unusedSupportPropertyTimer.setInterval(compositorLostMessageDelay); m_unusedSupportPropertyTimer.setInterval(compositorLostMessageDelay);
m_unusedSupportPropertyTimer.setSingleShot(true); m_unusedSupportPropertyTimer.setSingleShot(true);
connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteUnusedSupportProperties())); connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteUnusedSupportProperties()));
if (kwinApp()->operationMode() != Application::OperationModeX11) {
if (kwinApp()->platform()->isReady()) { // delay the call to setup by one event cycle
QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection); // The ctor of this class is invoked from the Workspace ctor, that means before
} // Workspace is completely constructed, so calling Workspace::self() would result
connect(kwinApp()->platform(), &Platform::readyChanged, this, // in undefined behavior. This is fixed by using a delayed invocation.
[this] (bool ready) { if (kwinApp()->platform()->isReady()) {
if (ready) {
setup();
} else {
finish();
}
}, Qt::QueuedConnection
);
connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this,
[this] {
delete cm_selection;
cm_selection = nullptr;
}
);
} else {
// delay the call to setup by one event cycle
// The ctor of this class is invoked from the Workspace ctor, that means before
// Workspace is completely constructed, so calling Workspace::self() would result
// in undefined behavior. This is fixed by using a delayed invocation.
QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection);
} }
connect(kwinApp()->platform(), &Platform::readyChanged, this,
[this] (bool ready) {
if (ready) {
setup();
} else {
finish();
}
}, Qt::QueuedConnection
);
connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this,
[this] {
delete cm_selection;
cm_selection = nullptr;
}
);
// register DBus // register DBus
new CompositorDBusInterface(this); new CompositorDBusInterface(this);
@ -649,7 +646,7 @@ void Compositor::performCompositing()
// If outputs are disabled, we return to the event loop and // If outputs are disabled, we return to the event loop and
// continue processing events until the outputs are enabled again // continue processing events until the outputs are enabled again
if (waylandServer() && !kwinApp()->platform()->areOutputsEnabled()) { if (!kwinApp()->platform()->areOutputsEnabled()) {
compositeTimer.stop(); compositeTimer.stop();
return; return;
} }
@ -796,7 +793,7 @@ void Compositor::setCompositeTimer()
return; return;
// Don't start the timer if all outputs are disabled // Don't start the timer if all outputs are disabled
if (waylandServer() && !kwinApp()->platform()->areOutputsEnabled()) { if (!kwinApp()->platform()->areOutputsEnabled()) {
return; return;
} }