[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kwin] /: Do not hard runtime depend on X11 in RuleBook
From: Martin_Flöser <null () kde ! org>
Date: 2017-09-10 15:08:04
Message-ID: E1dr3q8-0006Ds-RQ () code ! kde ! org
[Download RAW message or body]
Git commit 8522ef17eea0daf913eaaf0ee2c2d02d43c9d475 by Martin Flöser.
Committed on 10/09/2017 at 15:06.
Pushed by graesslin into branch 'master'.
Do not hard runtime depend on X11 in RuleBook
Summary:
The RuleBook is created during Workspace startup, so it's a required
component for the overall KWin session. It uses a KXMessages object which
means it has a hard X11 runtime dependency.
This change makes the dependency optional and creates the KXMessages once
X11 is available.
Test Plan: Compiles
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7653
M +14 -2 rules.cpp
M +1 -0 rules.h
https://commits.kde.org/kwin/8522ef17eea0daf913eaaf0ee2c2d02d43c9d475
diff --git a/rules.cpp b/rules.cpp
index 2883ec5c9..efeb107c0 100644
--- a/rules.cpp
+++ b/rules.cpp
@@ -955,9 +955,10 @@ RuleBook::RuleBook(QObject *parent)
: QObject(parent)
, m_updateTimer(new QTimer(this))
, m_updatesDisabled(false)
- , m_temporaryRulesMessages(new KXMessages(connection(), rootWindow(), "_KDE_NET_WM_TEMPORARY_RULES", nullptr))
+ , m_temporaryRulesMessages()
{
- connect(m_temporaryRulesMessages.data(), SIGNAL(gotMessage(QString)), SLOT(temporaryRulesMessage(QString)));
+ initWithX11();
+ connect(kwinApp(), &Application::x11ConnectionChanged, this, &RuleBook::initWithX11);
connect(m_updateTimer, SIGNAL(timeout()), SLOT(save()));
m_updateTimer->setInterval(1000);
m_updateTimer->setSingleShot(true);
@@ -969,6 +970,17 @@ RuleBook::~RuleBook()
deleteAll();
}
+void RuleBook::initWithX11()
+{
+ auto c = kwinApp()->x11Connection();
+ if (!c) {
+ m_temporaryRulesMessages.reset();
+ return;
+ }
+ m_temporaryRulesMessages.reset(new KXMessages(c, kwinApp()->x11RootWindow(), "_KDE_NET_WM_TEMPORARY_RULES", nullptr));
+ connect(m_temporaryRulesMessages.data(), SIGNAL(gotMessage(QString)), SLOT(temporaryRulesMessage(QString)));
+}
+
void RuleBook::deleteAll()
{
qDeleteAll(m_rules);
diff --git a/rules.h b/rules.h
index 66e80c576..25044d861 100644
--- a/rules.h
+++ b/rules.h
@@ -306,6 +306,7 @@ private Q_SLOTS:
private:
void deleteAll();
+ void initWithX11();
QTimer *m_updateTimer;
bool m_updatesDisabled;
QList<Rules*> m_rules;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic