diff --git a/effects.cpp b/effects.cpp index 7221ec87cc..f6841a582f 100644 --- a/effects.cpp +++ b/effects.cpp @@ -825,6 +825,11 @@ void EffectsHandlerImpl::registerGlobalShortcut(const QKeySequence &shortcut, QA input()->registerShortcut(shortcut, action); } +void EffectsHandlerImpl::registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action) +{ + input()->registerPointerShortcut(modifiers, pointerButtons, action); +} + void* EffectsHandlerImpl::getProxy(QString name) { // All effects start with "kwin4_effect_", prepend it to the name diff --git a/effects.h b/effects.h index d09c6b2fed..3ff4df4fd3 100644 --- a/effects.h +++ b/effects.h @@ -119,6 +119,7 @@ public: void startMouseInterception(Effect *effect, Qt::CursorShape shape) override; void stopMouseInterception(Effect *effect) override; void registerGlobalShortcut(const QKeySequence &shortcut, QAction *action) override; + void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action) override; void* getProxy(QString name) override; void startMousePolling() override; void stopMousePolling() override; diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 5fe5a5d0ba..3908d01a6c 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -202,6 +202,7 @@ void CubeEffect::reconfigure(ReconfigureFlags) KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); KGlobalAccel::self()->setShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F11, cubeAction); + effects->registerPointerShortcut(Qt::ControlModifier | Qt::AltModifier, Qt::LeftButton, cubeAction); cubeShortcut = KGlobalAccel::self()->shortcut(cubeAction); QAction* cylinderAction = new QAction(this); cylinderAction->setObjectName(QStringLiteral("Cylinder")); diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 1038d9656e..c8aabce504 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -742,6 +742,14 @@ public: * @param action The action which gets triggered when the shortcut matches */ virtual void registerGlobalShortcut(const QKeySequence &shortcut, QAction *action) = 0; + /** + * @brief Registers a global pointer shortcut with the provided @p action. + * + * @param modifiers The keyboard modifiers which need to be holded + * @param pointerButtons The pointer buttons which need to be pressed + * @param action The action which gets triggered when the shortcut matches + **/ + virtual void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action) = 0; /** * Retrieve the proxy class for an effect if it has one. Will return NULL if