diff --git a/src/globalshortcuts.cpp b/src/globalshortcuts.cpp index 635e7b4141..b148f858f4 100644 --- a/src/globalshortcuts.cpp +++ b/src/globalshortcuts.cpp @@ -236,11 +236,27 @@ bool match(QList &shortcuts, Args... args) // TODO(C++20): use ranges for a nicer way of filtering by shortcut type bool GlobalShortcutsManager::processPointerPressed(Qt::KeyboardModifiers mods, Qt::MouseButtons pointerButtons) { + // currently only used to better support modifier only shortcuts + // modifier-only shortcuts are not triggered if a pointer button is pressed + if (m_kglobalAccelInterface) { + QMetaObject::invokeMethod(m_kglobalAccelInterface, + "checkPointerPressed", + Qt::DirectConnection, + Q_ARG(Qt::MouseButtons, pointerButtons)); + } return match(m_shortcuts, mods, pointerButtons); } bool GlobalShortcutsManager::processAxis(Qt::KeyboardModifiers mods, PointerAxisDirection axis) { + // currently only used to better support modifier only shortcuts + // modifier-only shortcuts are not triggered if a pointer axis is used + if (m_kglobalAccelInterface) { + QMetaObject::invokeMethod(m_kglobalAccelInterface, + "checkAxisTriggered", + Qt::DirectConnection, + Q_ARG(int, axis)); + } return match(m_shortcuts, mods, axis); } diff --git a/src/plugins/kglobalaccel/kglobalaccel_plugin.cpp b/src/plugins/kglobalaccel/kglobalaccel_plugin.cpp index d13da224e0..241754e788 100644 --- a/src/plugins/kglobalaccel/kglobalaccel_plugin.cpp +++ b/src/plugins/kglobalaccel/kglobalaccel_plugin.cpp @@ -52,4 +52,14 @@ bool KGlobalAccelImpl::checkKeyReleased(int keyQt) return keyReleased(keyQt); } +bool KGlobalAccelImpl::checkPointerPressed(Qt::MouseButtons buttons) +{ + return pointerPressed(buttons); +} + +bool KGlobalAccelImpl::checkAxisTriggered(int axis) +{ + return axisTriggered(axis); +} + #include "moc_kglobalaccel_plugin.cpp" diff --git a/src/plugins/kglobalaccel/kglobalaccel_plugin.h b/src/plugins/kglobalaccel/kglobalaccel_plugin.h index 804b3a8c4e..d7b85c987c 100644 --- a/src/plugins/kglobalaccel/kglobalaccel_plugin.h +++ b/src/plugins/kglobalaccel/kglobalaccel_plugin.h @@ -28,6 +28,8 @@ public: public Q_SLOTS: bool checkKeyPressed(int keyQt); bool checkKeyReleased(int keyQt); + bool checkPointerPressed(Qt::MouseButtons buttons); + bool checkAxisTriggered(int axis); private: bool m_shuttingDown = false;