From 8461344ce1d3c777fa2064560650f3fea8621bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 26 Jun 2015 10:51:11 +0200 Subject: [PATCH] [wayland] Create a KGlobalAccelD during startup We need to grab the DBusInterface before anything interacts with org.kde.kglobalaccel to prevent kglobalaccel5 from starting. --- CMakeLists.txt | 1 + globalshortcuts.cpp | 13 +++++++++++++ globalshortcuts.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4bec2117a..c3b6d7ab8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -498,6 +498,7 @@ set(kwin_KDE_LIBS KF5::ConfigWidgets KF5::Crash KF5::GlobalAccel + KF5::GlobalAccelPrivate KF5::I18n KF5::Notifications KF5::Service diff --git a/globalshortcuts.cpp b/globalshortcuts.cpp index 8d4a491eb2..0fafac3af0 100644 --- a/globalshortcuts.cpp +++ b/globalshortcuts.cpp @@ -21,9 +21,12 @@ along with this program. If not, see . #include "globalshortcuts.h" // kwin #include +#include "main.h" +#include "utils.h" // KDE #include #include +#include // Qt #include @@ -91,6 +94,16 @@ GlobalShortcutsManager::GlobalShortcutsManager(QObject *parent) : QObject(parent) , m_config(KSharedConfig::openConfig(QStringLiteral("kglobalshortcutsrc"), KConfig::SimpleConfig)) { + if (kwinApp()->shouldUseWaylandForCompositing()) { + m_kglobalAccel = new KGlobalAccelD(this); + if (!m_kglobalAccel->init()) { + qCDebug(KWIN_CORE) << "Init of kglobalaccel failed"; + delete m_kglobalAccel; + m_kglobalAccel = nullptr; + } else { + qCDebug(KWIN_CORE) << "KGlobalAcceld inited"; + } + } } template diff --git a/globalshortcuts.h b/globalshortcuts.h index 30dfa0d3e4..fa7a89580c 100644 --- a/globalshortcuts.h +++ b/globalshortcuts.h @@ -27,6 +27,7 @@ along with this program. If not, see . #include class QAction; +class KGlobalAccelD; namespace KWin { @@ -104,6 +105,7 @@ private: QHash > m_pointerShortcuts; QHash > m_axisShortcuts; KSharedConfigPtr m_config; + KGlobalAccelD *m_kglobalAccel = nullptr; }; class GlobalShortcut