From 81a7a528bb0c79329f4b794fb1664848d3fab87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 6 Dec 2013 10:28:42 +0100 Subject: [PATCH] [kwin] Block global shortcuts without KGlobalSettings DBus call directly to kglobalacceld and don't wait for a signal to come back. --- workspace.cpp | 25 +++++++------------------ workspace.h | 1 - 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index 9d9579ee0d..5f68d267ce 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -64,7 +64,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -323,8 +322,6 @@ void Workspace::init() connect(&reconfigureTimer, SIGNAL(timeout()), this, SLOT(slotReconfigure())); connect(&updateToolWindowsTimer, SIGNAL(timeout()), this, SLOT(slotUpdateToolWindows())); - connect(KGlobalSettings::self(), SIGNAL(blockShortcuts(int)), this, SLOT(slotBlockShortcuts(int))); - // TODO: do we really need to reconfigure everything when fonts change? // maybe just reconfigure the decorations? Move this into libkdecoration? QDBusConnection::sessionBus().connect(QString(), @@ -1374,26 +1371,18 @@ void Workspace::resetShowingDesktop(bool keep_hidden) --block_showing_desktop; } -static bool pending_dfc = false; - void Workspace::disableGlobalShortcutsForClient(bool disable) { if (global_shortcuts_disabled_for_client == disable) return; - if (disable) - pending_dfc = true; - KGlobalSettings::self()->emitChange(KGlobalSettings::BlockShortcuts, disable); - // KWin will get the kipc message too -} + QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kglobalaccel"), + QStringLiteral("/kglobalaccel"), + QStringLiteral("org.kde.KGlobalAccel"), + QStringLiteral("blockGlobalShortcuts")); + message.setArguments(QList() << disable); + QDBusConnection::sessionBus().asyncCall(message); -void Workspace::slotBlockShortcuts(int data) -{ - if (pending_dfc && data) { - global_shortcuts_disabled_for_client = true; - pending_dfc = false; - } else { - global_shortcuts_disabled_for_client = false; - } + global_shortcuts_disabled_for_client = disable; // Update also Alt+LMB actions etc. for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); diff --git a/workspace.h b/workspace.h index 4024c47932..f8fba4d9c7 100644 --- a/workspace.h +++ b/workspace.h @@ -377,7 +377,6 @@ private Q_SLOTS: void desktopResized(); void slotUpdateToolWindows(); void delayFocus(); - void slotBlockShortcuts(int data); void slotReloadConfig(); void updateCurrentActivity(const QString &new_activity); // virtual desktop handling