[wayland] Create a KGlobalAccelD during startup

We need to grab the DBusInterface before anything interacts with
org.kde.kglobalaccel to prevent kglobalaccel5 from starting.
This commit is contained in:
Martin Gräßlin 2015-06-26 10:51:11 +02:00
parent 37c7e4c256
commit 8461344ce1
3 changed files with 16 additions and 0 deletions

View file

@ -498,6 +498,7 @@ set(kwin_KDE_LIBS
KF5::ConfigWidgets
KF5::Crash
KF5::GlobalAccel
KF5::GlobalAccelPrivate
KF5::I18n
KF5::Notifications
KF5::Service

View file

@ -21,9 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "globalshortcuts.h"
// kwin
#include <config-kwin.h>
#include "main.h"
#include "utils.h"
// KDE
#include <kkeyserver.h>
#include <KConfigGroup>
#include <KGlobalAccel/private/kglobalacceld.h>
// Qt
#include <QAction>
@ -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 <typename T>

View file

@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QKeySequence>
class QAction;
class KGlobalAccelD;
namespace KWin
{
@ -104,6 +105,7 @@ private:
QHash<Qt::KeyboardModifiers, QHash<Qt::MouseButtons, GlobalShortcut*> > m_pointerShortcuts;
QHash<Qt::KeyboardModifiers, QHash<PointerAxisDirection, GlobalShortcut*> > m_axisShortcuts;
KSharedConfigPtr m_config;
KGlobalAccelD *m_kglobalAccel = nullptr;
};
class GlobalShortcut