Export global pointer shortcuts to effect system and use it for cube

Used in cube effect as an example with hard coded ctrl+alt+left click.

BUG: 163121
This commit is contained in:
Martin Gräßlin 2013-07-14 22:58:30 +02:00
parent 28406d153d
commit 5ea990a740
4 changed files with 15 additions and 0 deletions

View file

@ -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

View file

@ -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;

View file

@ -202,6 +202,7 @@ void CubeEffect::reconfigure(ReconfigureFlags)
KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
KGlobalAccel::self()->setShortcut(cubeAction, QList<QKeySequence>() << 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"));

View file

@ -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