kwin/src/globalshortcuts.cpp

314 lines
11 KiB
C++
Raw Normal View History

2020-08-02 22:22:19 +00:00
/*
KWin - the KDE window manager
This file is part of the KDE project.
2020-08-02 22:22:19 +00:00
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
2020-08-02 22:22:19 +00:00
SPDX-License-Identifier: GPL-2.0-or-later
*/
// own
#include "globalshortcuts.h"
// config
#include <config-kwin.h>
// kwin
2021-03-30 13:32:32 +00:00
#include "gestures.h"
#include "kwinglobals.h"
#include "main.h"
2022-01-18 08:35:52 +00:00
#include "utils/common.h"
// KDE
#include <KGlobalAccel/private/kglobalaccel_interface.h>
2021-03-30 13:32:32 +00:00
#include <KGlobalAccel/private/kglobalacceld.h>
// Qt
#include <QAction>
// system
#include <signal.h>
#include <variant>
#include <iostream>
namespace KWin
{
2021-03-30 13:32:32 +00:00
GlobalShortcut::GlobalShortcut(Shortcut &&sc, QAction *action)
: m_shortcut(std::move(sc))
2021-03-30 13:32:32 +00:00
, m_action(action)
{
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
}
GlobalShortcut::~GlobalShortcut()
{
}
2021-03-30 13:32:32 +00:00
QAction *GlobalShortcut::action() const
{
return m_action;
}
void GlobalShortcut::invoke() const
{
QMetaObject::invokeMethod(m_action, "trigger", Qt::QueuedConnection);
}
2021-03-30 13:32:32 +00:00
const Shortcut &GlobalShortcut::shortcut() const
{
return m_shortcut;
}
GlobalShortcutsManager::GlobalShortcutsManager(QObject *parent)
: QObject(parent)
, m_touchpadGestureRecognizer(new GestureRecognizer(this))
, m_touchscreenGestureRecognizer(new GestureRecognizer(this))
{
}
GlobalShortcutsManager::~GlobalShortcutsManager()
{
}
void GlobalShortcutsManager::init()
{
if (kwinApp()->shouldUseWaylandForCompositing()) {
qputenv("KGLOBALACCELD_PLATFORM", QByteArrayLiteral("org.kde.kwin"));
m_kglobalAccel = std::make_unique<KGlobalAccelD>();
if (!m_kglobalAccel->init()) {
qCDebug(KWIN_CORE) << "Init of kglobalaccel failed";
m_kglobalAccel.reset();
} else {
qCDebug(KWIN_CORE) << "KGlobalAcceld inited";
}
}
}
void GlobalShortcutsManager::objectDeleted(QObject *object)
{
auto it = m_shortcuts.begin();
while (it != m_shortcuts.end()) {
if (it->action() == object) {
it = m_shortcuts.erase(it);
} else {
++it;
}
}
}
bool GlobalShortcutsManager::addIfNotExists(GlobalShortcut sc, GestureDeviceType device)
{
for (const auto &cs : qAsConst(m_shortcuts)) {
if (sc.shortcut() == cs.shortcut()) {
return false;
}
}
// Register if GestureSHortcut
const auto &recognizer = device == GestureDeviceType::Touchpad ? m_touchpadGestureRecognizer : m_touchscreenGestureRecognizer;
if (std::holds_alternative<GestureShortcut>(sc.shortcut())) {
const GestureShortcut *shortcut = &std::get<GestureShortcut>(sc.shortcut());
if (shortcut->swipeGesture) {
recognizer->registerSwipeGesture(shortcut->swipeGesture.get());
} else {
recognizer->registerPinchGesture(shortcut->pinchGesture.get());
}
}
connect(sc.action(), &QAction::destroyed, this, &GlobalShortcutsManager::objectDeleted);
m_shortcuts.push_back(std::move(sc));
return true;
}
void GlobalShortcutsManager::registerPointerShortcut(QAction *action, Qt::KeyboardModifiers modifiers, Qt::MouseButtons pointerButtons)
{
2021-03-30 13:32:32 +00:00
addIfNotExists(GlobalShortcut(PointerButtonShortcut{modifiers, pointerButtons}, action));
}
void GlobalShortcutsManager::registerAxisShortcut(QAction *action, Qt::KeyboardModifiers modifiers, PointerAxisDirection axis)
{
2021-03-30 13:32:32 +00:00
addIfNotExists(GlobalShortcut(PointerAxisShortcut{modifiers, axis}, action));
}
2022-09-10 18:34:21 +00:00
void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureType direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
{
// Create and setup the GestureShortcut
GestureShortcut shortcut{device, direction};
if (isSwipeDirection(direction)) {
std::unique_ptr<SwipeGesture> gesture = std::make_unique<SwipeGesture>();
gesture->addFingerCount(fingerCount);
gesture->setTriggerDelta(QSizeF(200, 200));
connect(gesture.get(), &SwipeGesture::semanticProgress, progressCallback);
connect(gesture.get(), &Gesture::triggered, onUp, &QAction::trigger, Qt::QueuedConnection);
connect(gesture.get(), &Gesture::cancelled, onUp, &QAction::trigger, Qt::QueuedConnection);
shortcut.swipeGesture = std::move(gesture);
} else if (isPinchDirection(direction)) {
std::unique_ptr<PinchGesture> gesture = std::make_unique<PinchGesture>();
gesture->addFingerCount(fingerCount);
connect(gesture.get(), &PinchGesture::semanticProgress, progressCallback);
connect(gesture.get(), &Gesture::triggered, onUp, &QAction::trigger, Qt::QueuedConnection);
connect(gesture.get(), &Gesture::cancelled, onUp, &QAction::trigger, Qt::QueuedConnection);
shortcut.pinchGesture = std::move(gesture);
}
2022-07-26 15:35:07 +00:00
shortcut.gesture()->setDirection(direction);
addIfNotExists(GlobalShortcut(std::move(shortcut), onUp), device);
}
2022-09-10 18:34:21 +00:00
void GlobalShortcutsManager::forceRegisterTouchscreenSwipe(QAction *onUp, std::function<void(qreal)> progressCallback, GestureTypeFlag direction, uint fingerCount)
{
std::unique_ptr<SwipeGesture> gesture = std::make_unique<SwipeGesture>();
gesture->addFingerCount(fingerCount);
gesture->setDirection(direction);
gesture->setTriggerDelta(QSizeF(200, 200));
connect(gesture.get(), &SwipeGesture::semanticProgress, progressCallback);
connect(gesture.get(), &Gesture::triggered, onUp, &QAction::trigger, Qt::QueuedConnection);
connect(gesture.get(), &Gesture::cancelled, onUp, &QAction::trigger, Qt::QueuedConnection);
GestureShortcut gestureShortcut{GestureDeviceType::Touchscreen, direction};
gestureShortcut.swipeGesture = std::move(gesture);
m_touchscreenGestureRecognizer->registerSwipeGesture(gestureShortcut.swipeGesture.get());
GlobalShortcut shortcut{std::move(gestureShortcut), onUp};
2022-05-27 15:26:24 +00:00
const auto it = std::find_if(m_shortcuts.begin(), m_shortcuts.end(), [&shortcut](const auto &s) {
return shortcut.shortcut() == s.shortcut();
});
if (it != m_shortcuts.end()) {
m_shortcuts.erase(it);
}
connect(shortcut.action(), &QAction::destroyed, this, &GlobalShortcutsManager::objectDeleted);
m_shortcuts.push_back(std::move(shortcut));
}
bool GlobalShortcutsManager::processKey(Qt::KeyboardModifiers mods, int keyQt)
{
if (m_kglobalAccelInterface) {
if (!keyQt && !mods) {
return false;
}
2021-03-30 13:32:32 +00:00
auto check = [this](Qt::KeyboardModifiers mods, int keyQt) {
bool retVal = false;
QMetaObject::invokeMethod(m_kglobalAccelInterface,
2021-03-30 13:32:32 +00:00
"checkKeyPressed",
Qt::DirectConnection,
Q_RETURN_ARG(bool, retVal),
Q_ARG(int, int(mods) | keyQt));
return retVal;
};
if (check(mods, keyQt)) {
return true;
} else if (keyQt == Qt::Key_Backtab) {
// KGlobalAccel on X11 has some workaround for Backtab
// see kglobalaccel/src/runtime/plugins/xcb/kglobalccel_x11.cpp method x11KeyPress
// Apparently KKeySequenceWidget captures Shift+Tab instead of Backtab
// thus if the key is backtab we should adjust to add shift again and use tab
// in addition KWin registers the shortcut incorrectly as Alt+Shift+Backtab
// this should be changed to either Alt+Backtab or Alt+Shift+Tab to match KKeySequenceWidget
// trying the variants
if (check(mods | Qt::ShiftModifier, keyQt)) {
return true;
}
if (check(mods | Qt::ShiftModifier, Qt::Key_Tab)) {
return true;
}
}
}
return false;
}
bool GlobalShortcutsManager::processKeyRelease(Qt::KeyboardModifiers mods, int keyQt)
{
if (m_kglobalAccelInterface) {
QMetaObject::invokeMethod(m_kglobalAccelInterface,
"checkKeyReleased",
Qt::DirectConnection,
Q_ARG(int, int(mods) | keyQt));
}
return false;
}
template<typename ShortcutKind, typename... Args>
bool match(std::vector<GlobalShortcut> &shortcuts, Args... args)
{
2021-03-30 13:32:32 +00:00
for (auto &sc : shortcuts) {
if (std::holds_alternative<ShortcutKind>(sc.shortcut())) {
if (std::get<ShortcutKind>(sc.shortcut()) == ShortcutKind{args...}) {
sc.invoke();
return true;
}
}
}
return false;
}
2021-03-30 13:32:32 +00:00
// TODO(C++20): use ranges for a nicer way of filtering by shortcut type
bool GlobalShortcutsManager::processPointerPressed(Qt::KeyboardModifiers mods, Qt::MouseButtons pointerButtons)
{
return match<PointerButtonShortcut>(m_shortcuts, mods, pointerButtons);
}
bool GlobalShortcutsManager::processAxis(Qt::KeyboardModifiers mods, PointerAxisDirection axis)
{
return match<PointerAxisShortcut>(m_shortcuts, mods, axis);
}
void GlobalShortcutsManager::processSwipeStart(GestureDeviceType device, uint fingerCount)
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
{
if (device == GestureDeviceType::Touchpad) {
m_touchpadGestureRecognizer->startSwipeGesture(fingerCount);
} else {
m_touchscreenGestureRecognizer->startSwipeGesture(fingerCount);
}
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
}
void GlobalShortcutsManager::processSwipeUpdate(GestureDeviceType device, const QSizeF &delta)
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
{
if (device == GestureDeviceType::Touchpad) {
m_touchpadGestureRecognizer->updateSwipeGesture(delta);
} else {
m_touchscreenGestureRecognizer->updateSwipeGesture(delta);
}
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
}
void GlobalShortcutsManager::processSwipeCancel(GestureDeviceType device)
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
{
if (device == GestureDeviceType::Touchpad) {
m_touchpadGestureRecognizer->cancelSwipeGesture();
} else {
m_touchscreenGestureRecognizer->cancelSwipeGesture();
}
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
}
void GlobalShortcutsManager::processSwipeEnd(GestureDeviceType device)
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
{
if (device == GestureDeviceType::Touchpad) {
m_touchpadGestureRecognizer->endSwipeGesture();
} else {
m_touchscreenGestureRecognizer->endSwipeGesture();
}
Add support for global touchpad swipe gestures Summary: This change adds global touchpad swipe gestures to the GlobalShortcutsManager and hooks up the swipe gestures as defined at the Plasma Affenfels sprint: * swipe up: Desktop Grid * swipe down: Present Windows * swipe left: previous virtual desktop * swipe right: next virtual desktop The main work is handled by two new classes: SwipeGesture and GestureRecognizer. This is implemented in a way that it can be extended to also recognize touch screen gestures and pinch gestures. The SwipeGesture defines what is required for the gesture to trigger. Currently this includes the minimum and maximum number of fingers participating in the gesture and the direction. The gesture gets registered in the GestureRecognizer. The events for the gesture are fed into the GestureRecognizer. It evaluates which gestures could trigger and tracks them for every update of the gesture. In the process of the gesture tracking the GestureRecognizer emits signals on the Gesture: * started: when the Gesture gets considered for a sequence * cancelled: the Gesture no longer matches the sequence * triggered: the sequence ended and the Gesture still matches The remaining changes are related to hook up the existing shortcut framework with the new touchpad gestures. The GlobalShortcutManager gained support for it, InputRedirection and EffectsHandler offer methods to register a QAction. VirtualDesktopManager, PresentWindows and DesktopGrid are adjusted to support the gesture. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5097
2017-03-18 10:00:30 +00:00
// TODO: cancel on Wayland Seat if one triggered
}
void GlobalShortcutsManager::processPinchStart(uint fingerCount)
{
m_touchpadGestureRecognizer->startPinchGesture(fingerCount);
}
void GlobalShortcutsManager::processPinchUpdate(qreal scale, qreal angleDelta, const QSizeF &delta)
{
m_touchpadGestureRecognizer->updatePinchGesture(scale, angleDelta, delta);
}
void GlobalShortcutsManager::processPinchCancel()
{
m_touchpadGestureRecognizer->cancelPinchGesture();
}
void GlobalShortcutsManager::processPinchEnd()
{
m_touchpadGestureRecognizer->endPinchGesture();
}
Gesture *GestureShortcut::gesture() const
{
if (swipeGesture != nullptr) {
return swipeGesture.get();
} else {
return pinchGesture.get();
}
}
} // namespace