diff --git a/kwinbindings.cpp b/kwinbindings.cpp
index 4ea6429321..0d517c8cb6 100644
--- a/kwinbindings.cpp
+++ b/kwinbindings.cpp
@@ -42,6 +42,9 @@ along with this program. If not, see .
#define DEF5( name, key, functor, value ) \
initShortcut(QStringLiteral(name).arg(value), i18n(name, value), key, functor, value);
+#define DEF6( name, key, target, fnSlot ) \
+ initShortcut(QStringLiteral(name), i18n(name), key, target, &fnSlot);
+
DEF(I18N_NOOP("Walk Through Window Tabs"), 0, slotActivateNextTab);
DEF(I18N_NOOP("Walk Through Window Tabs (Reverse)"), 0, slotActivatePrevTab);
@@ -157,7 +160,7 @@ DEF(I18N_NOOP("Switch to Previous Screen"), 0, slotSwitchToPrevScreen);
DEF(I18N_NOOP("Kill Window"), Qt::CTRL + Qt::ALT + Qt::Key_Escape, slotKillWindow);
DEF(I18N_NOOP("Suspend Compositing"), Qt::SHIFT + Qt::ALT + Qt::Key_F12, slotToggleCompositing);
-DEF(I18N_NOOP("Invert Screen Colors"), 0, slotInvertScreen);
+DEF6(I18N_NOOP("Invert Screen Colors"), 0, kwinApp()->platform(), Platform::invertScreen);
#undef DEF
#undef DEF2
diff --git a/useractions.cpp b/useractions.cpp
index 124f9b3f8c..232882aa0e 100644
--- a/useractions.cpp
+++ b/useractions.cpp
@@ -979,6 +979,12 @@ void Workspace::closeActivePopup()
template
void Workspace::initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, Slot slot, const QVariant &data)
+{
+ initShortcut(actionName, description, shortcut, this, slot, data);
+}
+
+template
+void Workspace::initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, T *receiver, Slot slot, const QVariant &data)
{
QAction *a = new QAction(this);
a->setProperty("componentName", QStringLiteral(KWIN_NAME));
@@ -989,7 +995,7 @@ void Workspace::initShortcut(const QString &actionName, const QString &descripti
}
KGlobalAccel::self()->setDefaultShortcut(a, QList() << shortcut);
KGlobalAccel::self()->setShortcut(a, QList() << shortcut);
- input()->registerShortcut(shortcut, a, this, slot);
+ input()->registerShortcut(shortcut, a, receiver, slot);
}
/*!
@@ -1703,11 +1709,6 @@ void Workspace::slotWindowResize()
performWindowOperation(active_client, Options::UnrestrictedResizeOp);
}
-void Workspace::slotInvertScreen()
-{
- kwinApp()->platform()->invertScreen();
-}
-
#undef USABLE_ACTIVE_CLIENT
void AbstractClient::setShortcut(const QString& _cut)
diff --git a/workspace.h b/workspace.h
index 9b60724b28..f27100e75b 100644
--- a/workspace.h
+++ b/workspace.h
@@ -444,7 +444,6 @@ public Q_SLOTS:
void slotSetupWindowShortcut();
void setupWindowShortcutDone(bool);
void slotToggleCompositing();
- void slotInvertScreen();
void updateClientArea();
@@ -502,6 +501,8 @@ private:
template
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut,
Slot slot, const QVariant &data = QVariant());
+ template
+ void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, T *receiver, Slot slot, const QVariant &data = QVariant());
void setupWindowShortcut(AbstractClient* c);
bool switchWindow(AbstractClient *c, Direction direction, QPoint curPos, int desktop);