globalshortcuts: send mouse events to kglobalacceld
This is needed so that kglobalacceld can correctly handle modifier-only shortcuts.
This commit is contained in:
parent
012c64b054
commit
5c16cdd4ed
3 changed files with 28 additions and 0 deletions
|
@ -236,11 +236,27 @@ bool match(QList<GlobalShortcut> &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<PointerButtonShortcut>(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<PointerAxisShortcut>(m_shortcuts, mods, axis);
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue