mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kwin: synchronously reload compositing settings, reparse configuration and check for screen locker service
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
3204a6f2c4
commit
0a01124878
5 changed files with 14 additions and 68 deletions
|
@ -42,8 +42,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QFutureWatcher>
|
||||
#include <QMenu>
|
||||
#include <QtCore/qcoreevent.h>
|
||||
#include <QDateTime>
|
||||
|
@ -146,23 +144,10 @@ void Compositor::setup()
|
|||
m_starting = true;
|
||||
|
||||
if (!options->isCompositingInitialized()) {
|
||||
// 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 {
|
||||
slotCompositingOptionsInitialized();
|
||||
}
|
||||
}
|
||||
// options->reloadCompositingSettings(true) initializes the CompositingPrefs
|
||||
options->reloadCompositingSettings(true);
|
||||
}
|
||||
|
||||
extern int screen_number; // main.cpp
|
||||
extern bool is_multihead;
|
||||
|
||||
void Compositor::slotCompositingOptionsInitialized()
|
||||
{
|
||||
char selection_name[ 100 ];
|
||||
sprintf(selection_name, "_NET_WM_CM_S%d", DefaultScreen(display()));
|
||||
if (!cm_selection) {
|
||||
|
|
|
@ -245,7 +245,6 @@ private Q_SLOTS:
|
|||
/**
|
||||
* Called from setupCompositing() when the CompositingPrefs are ready.
|
||||
**/
|
||||
void slotCompositingOptionsInitialized();
|
||||
void finish();
|
||||
/**
|
||||
* Restarts the Compositor if running.
|
||||
|
|
|
@ -43,8 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "workspace.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFutureWatcher>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QDBusServiceWatcher>
|
||||
#include <QtDBus/qdbuspendingcall.h>
|
||||
#include <QLibrary>
|
||||
|
@ -102,12 +100,14 @@ ScreenLockerWatcher::ScreenLockerWatcher(QObject *parent)
|
|||
m_serviceWatcher->setWatchMode(QDBusServiceWatcher::WatchForOwnerChange);
|
||||
m_serviceWatcher->addWatchedService(SCREEN_LOCKER_SERVICE_NAME);
|
||||
// check whether service is registered
|
||||
QFutureWatcher<QDBusReply<bool> > *watcher = new QFutureWatcher<QDBusReply<bool> >(this);
|
||||
connect(watcher, SIGNAL(finished()), SLOT(serviceRegisteredQueried()));
|
||||
connect(watcher, SIGNAL(canceled()), watcher, SLOT(deleteLater()));
|
||||
watcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(),
|
||||
&QDBusConnectionInterface::isServiceRegistered,
|
||||
SCREEN_LOCKER_SERVICE_NAME));
|
||||
QDBusConnectionInterface* dbusConnection = QDBusConnection::sessionBus().interface();
|
||||
QDBusReply<bool> reply = dbusConnection->isServiceRegistered(SCREEN_LOCKER_SERVICE_NAME);
|
||||
if (reply.isValid() && reply.value()) {
|
||||
QDBusReply<QString> reply2 = dbusConnection->serviceOwner(SCREEN_LOCKER_SERVICE_NAME);
|
||||
if (reply2.isValid()) {
|
||||
serviceOwnerChanged(SCREEN_LOCKER_SERVICE_NAME, QString(), reply2.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScreenLockerWatcher::~ScreenLockerWatcher()
|
||||
|
@ -131,38 +131,6 @@ void ScreenLockerWatcher::serviceOwnerChanged(const QString &serviceName, const
|
|||
}
|
||||
}
|
||||
|
||||
void ScreenLockerWatcher::serviceRegisteredQueried()
|
||||
{
|
||||
QFutureWatcher<QDBusReply<bool> > *watcher = dynamic_cast<QFutureWatcher<QDBusReply<bool> > *>(sender());
|
||||
if (!watcher) {
|
||||
return;
|
||||
}
|
||||
const QDBusReply<bool> &reply = watcher->result();
|
||||
if (reply.isValid() && reply.value()) {
|
||||
QFutureWatcher<QDBusReply<QString> > *ownerWatcher = new QFutureWatcher<QDBusReply<QString> >(this);
|
||||
connect(ownerWatcher, SIGNAL(finished()), SLOT(serviceOwnerQueried()));
|
||||
connect(ownerWatcher, SIGNAL(canceled()), ownerWatcher, SLOT(deleteLater()));
|
||||
ownerWatcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(),
|
||||
&QDBusConnectionInterface::serviceOwner,
|
||||
SCREEN_LOCKER_SERVICE_NAME));
|
||||
}
|
||||
watcher->deleteLater();
|
||||
}
|
||||
|
||||
void ScreenLockerWatcher::serviceOwnerQueried()
|
||||
{
|
||||
QFutureWatcher<QDBusReply<QString> > *watcher = dynamic_cast<QFutureWatcher<QDBusReply<QString> > *>(sender());
|
||||
if (!watcher) {
|
||||
return;
|
||||
}
|
||||
const QDBusReply<QString> reply = watcher->result();
|
||||
if (reply.isValid()) {
|
||||
serviceOwnerChanged(SCREEN_LOCKER_SERVICE_NAME, QString(), reply.value());
|
||||
}
|
||||
|
||||
watcher->deleteLater();
|
||||
}
|
||||
|
||||
void ScreenLockerWatcher::activeQueried(QDBusPendingCallWatcher *watcher)
|
||||
{
|
||||
QDBusPendingReply<bool> reply = *watcher;
|
||||
|
|
|
@ -399,8 +399,6 @@ private Q_SLOTS:
|
|||
void setLocked(bool activated);
|
||||
void activeQueried(QDBusPendingCallWatcher *watcher);
|
||||
void serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner);
|
||||
void serviceRegisteredQueried();
|
||||
void serviceOwnerQueried();
|
||||
private:
|
||||
OrgFreedesktopScreenSaverInterface *m_interface;
|
||||
QDBusServiceWatcher *m_serviceWatcher;
|
||||
|
|
|
@ -60,12 +60,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KWindowInfo>
|
||||
#include <KWindowSystem>
|
||||
// Qt
|
||||
#include <QtConcurrentRun>
|
||||
#include <QtCore/qmetaobject.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
// main.cpp
|
||||
extern int screen_number;
|
||||
extern bool is_multihead;
|
||||
|
||||
|
@ -128,9 +128,6 @@ Workspace::Workspace(bool restore)
|
|||
, block_stacking_updates(0)
|
||||
, forced_global_mouse_grab(false)
|
||||
{
|
||||
// If KWin was already running it saved its configuration after loosing the selection -> Reread
|
||||
QFuture<void> reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration);
|
||||
|
||||
_self = this;
|
||||
|
||||
// first initialize the extensions
|
||||
|
@ -140,8 +137,8 @@ Workspace::Workspace(bool restore)
|
|||
// start the cursor support
|
||||
Cursor::create(this);
|
||||
|
||||
// PluginMgr needs access to the config file, so we need to wait for it for finishing
|
||||
reparseConfigFuture.waitForFinished();
|
||||
// PluginMgr needs access to the config file, so we need to wait for
|
||||
options->reparseConfiguration();
|
||||
|
||||
// get screen support
|
||||
Screens *screens = Screens::create(this);
|
||||
|
@ -1063,7 +1060,6 @@ void Workspace::sendClientToDesktop(Client* c, int desk, bool dont_activate)
|
|||
* this is NOT in any way related to XRandR multiscreen
|
||||
*
|
||||
*/
|
||||
extern bool is_multihead; // main.cpp
|
||||
bool Workspace::isOnCurrentHead()
|
||||
{
|
||||
if (!is_multihead) {
|
||||
|
|
Loading…
Add table
Reference in a new issue