Commit 9b182780 authored by Martin Flöser's avatar Martin Flöser

Drop delegating Workspace::slotInvertScreen

Instead directly connect global shortcut to the method in Platform.
parent e6ca3213
......@@ -42,6 +42,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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
......
......@@ -979,6 +979,12 @@ void Workspace::closeActivePopup()
template <typename Slot>
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 <typename T, typename Slot>
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<QKeySequence>() << shortcut);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << 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)
......
......@@ -444,7 +444,6 @@ public Q_SLOTS:
void slotSetupWindowShortcut();
void setupWindowShortcutDone(bool);
void slotToggleCompositing();
void slotInvertScreen();
void updateClientArea();
......@@ -502,6 +501,8 @@ private:
template <typename Slot>
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut,
Slot slot, const QVariant &data = QVariant());
template <typename T, typename Slot>
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment