Commit 74da8076 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Revert "Rename GestureDirection to GestureType"

This reverts commit 5de6c507.

It was pushed with unreviewed changes and not fully resolved issues.
parent 5de6c507
......@@ -378,7 +378,7 @@ void TouchInputTest::testGestureDetection()
qWarning() << "progress callback!" << progress;
};
QAction action;
input()->forceRegisterTouchscreenSwipeShortcut(GestureTypeFlag::Right, 3, &action, callback);
input()->forceRegisterTouchscreenSwipeShortcut(GestureDirection::Right, 3, &action, callback);
// verify that gestures are detected
......
......@@ -54,26 +54,26 @@ private Q_SLOTS:
void GestureTest::testDirection_data()
{
QTest::addColumn<GestureTypeFlag>("direction");
QTest::newRow("Up") << GestureTypeFlag::Up;
QTest::newRow("Left") << GestureTypeFlag::Left;
QTest::newRow("Right") << GestureTypeFlag::Right;
QTest::newRow("Down") << GestureTypeFlag::Down;
QTest::newRow("Contracting") << GestureTypeFlag::Contracting;
QTest::newRow("Expanding") << GestureTypeFlag::Expanding;
QTest::addColumn<GestureDirection>("direction");
QTest::newRow("Up") << GestureDirection::Up;
QTest::newRow("Left") << GestureDirection::Left;
QTest::newRow("Right") << GestureDirection::Right;
QTest::newRow("Down") << GestureDirection::Down;
QTest::newRow("Contracting") << GestureDirection::Contracting;
QTest::newRow("Expanding") << GestureDirection::Expanding;
}
void GestureTest::testDirection()
{
SwipeGesture gesture;
QCOMPARE(gesture.direction(), 0);
QFETCH(GestureTypeFlag, direction);
QFETCH(GestureDirection, direction);
gesture.setDirection(direction);
QCOMPARE(gesture.direction(), direction);
// back to down
gesture.setDirection(GestureTypeFlag::Down);
QCOMPARE(gesture.direction(), GestureTypeFlag::Down);
gesture.setDirection(GestureDirection::Down);
QCOMPARE(gesture.direction(), GestureDirection::Down);
}
void GestureTest::testMinimumX_data()
......@@ -231,19 +231,19 @@ void GestureTest::testDeleteSwipeCancels()
void GestureTest::testSwipeCancel_data()
{
QTest::addColumn<GestureTypeFlag>("direction");
QTest::addColumn<GestureDirection>("direction");
QTest::newRow("Up") << GestureTypeFlag::Up;
QTest::newRow("Left") << GestureTypeFlag::Left;
QTest::newRow("Right") << GestureTypeFlag::Right;
QTest::newRow("Down") << GestureTypeFlag::Down;
QTest::newRow("Up") << GestureDirection::Up;
QTest::newRow("Left") << GestureDirection::Left;
QTest::newRow("Right") << GestureDirection::Right;
QTest::newRow("Down") << GestureDirection::Down;
}
void GestureTest::testSwipeCancel()
{
GestureRecognizer recognizer;
std::unique_ptr<SwipeGesture> gesture(new SwipeGesture);
QFETCH(GestureTypeFlag, direction);
QFETCH(GestureDirection, direction);
gesture->setDirection(direction);
QSignalSpy startedSpy(gesture.get(), &SwipeGesture::started);
......@@ -264,20 +264,20 @@ void GestureTest::testSwipeCancel()
void GestureTest::testSwipeUpdateTrigger_data()
{
QTest::addColumn<GestureTypeFlag>("direction");
QTest::addColumn<GestureDirection>("direction");
QTest::addColumn<QSizeF>("delta");
QTest::newRow("Up") << GestureTypeFlag::Up << QSizeF(2, -3);
QTest::newRow("Left") << GestureTypeFlag::Left << QSizeF(-3, 1);
QTest::newRow("Right") << GestureTypeFlag::Right << QSizeF(20, -19);
QTest::newRow("Down") << GestureTypeFlag::Down << QSizeF(0, 50);
QTest::newRow("Up") << GestureDirection::Up << QSizeF(2, -3);
QTest::newRow("Left") << GestureDirection::Left << QSizeF(-3, 1);
QTest::newRow("Right") << GestureDirection::Right << QSizeF(20, -19);
QTest::newRow("Down") << GestureDirection::Down << QSizeF(0, 50);
}
void GestureTest::testSwipeUpdateTrigger()
{
GestureRecognizer recognizer;
SwipeGesture gesture;
QFETCH(GestureTypeFlag, direction);
QFETCH(GestureDirection, direction);
gesture.setDirection(direction);
gesture.setTriggerDelta(QSizeF(1, 1));
......@@ -333,11 +333,11 @@ void GestureTest::testNotEmitCallbacksBeforeDirectionDecided()
SwipeGesture right;
PinchGesture expand;
PinchGesture contract;
up.setDirection(GestureTypeFlag::Up);
down.setDirection(GestureTypeFlag::Down);
right.setDirection(GestureTypeFlag::Right);
expand.setDirection(GestureTypeFlag::Expanding);
contract.setDirection(GestureTypeFlag::Contracting);
up.setDirection(GestureDirection::Up);
down.setDirection(GestureDirection::Down);
right.setDirection(GestureDirection::Right);
expand.setDirection(GestureDirection::Expanding);
contract.setDirection(GestureDirection::Contracting);
recognizer.registerSwipeGesture(&up);
recognizer.registerSwipeGesture(&down);
recognizer.registerSwipeGesture(&right);
......
......@@ -32,7 +32,7 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi
Q_UNUSED(action)
}
void InputRedirection::registerGesture(GestureDeviceType, GestureTypeFlag, uint, QAction *, std::function<void(qreal)>)
void InputRedirection::registerGesture(GestureDeviceType, GestureDirection, uint, QAction *, std::function<void(qreal)>)
{
}
}
......
......@@ -816,7 +816,7 @@ void EffectsHandlerImpl::registerAxisShortcut(Qt::KeyboardModifiers modifiers, P
input()->registerAxisShortcut(modifiers, axis, action);
}
void EffectsHandlerImpl::registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
void EffectsHandlerImpl::registerGesture(GestureDeviceType device, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
{
input()->registerGesture(device, direction, fingerCount, onUp, progressCallback);
}
......
......@@ -104,7 +104,7 @@ public:
void registerGlobalShortcut(const QKeySequence &shortcut, QAction *action) override;
void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action) override;
void registerAxisShortcut(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, QAction *action) override;
void registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback) override;
void registerGesture(GestureDeviceType device, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback) override;
void *getProxy(QString name) override;
void startMousePolling() override;
......
......@@ -61,7 +61,7 @@ DesktopGridEffect::DesktopGridEffect()
}
});
effects->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Up, 4, m_realtimeToggleAction, [this](qreal progress) {
effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Up, 4, m_realtimeToggleAction, [this](qreal progress) {
progress = std::clamp(progress, 0.0, 1.0);
if (!effects->hasActiveFullScreenEffect() || effects->activeFullScreenEffect() == this) {
switch (m_status) {
......
......@@ -67,8 +67,8 @@ OverviewEffect::OverviewEffect()
}
};
effects->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Contracting, 4, m_realtimeToggleAction, progressCallback);
effects->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Up, 3, m_realtimeToggleAction, progressCallback);
effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Contracting, 4, m_realtimeToggleAction, progressCallback);
effects->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Up, 3, m_realtimeToggleAction, progressCallback);
connect(effects, &EffectsHandler::screenAboutToLock, this, &OverviewEffect::realDeactivate);
......
......@@ -126,8 +126,8 @@ WindowViewEffect::WindowViewEffect()
}
}
};
effects->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Down, 4, m_realtimeToggleAction, gestureCallback);
effects->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Down, 3, m_realtimeToggleAction, gestureCallback);
effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Down, 4, m_realtimeToggleAction, gestureCallback);
effects->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Down, 3, m_realtimeToggleAction, gestureCallback);
reconfigure(ReconfigureAll);
}
......
......@@ -49,25 +49,25 @@ qreal SwipeGesture::getTriggerProgress(const QSizeF &delta) const
qreal progress = 0.0;
if (m_direction & GestureTypeFlag::Up) {
if (m_direction & GestureDirection::Up) {
qreal candidate = -delta.height() / m_triggerDelta.height();
if (candidate > progress) {
progress = candidate;
}
}
if (m_direction & GestureTypeFlag::Down) {
if (m_direction & GestureDirection::Down) {
qreal candidate = delta.height() / m_triggerDelta.height();
if (candidate > progress) {
progress = candidate;
}
}
if (m_direction & GestureTypeFlag::Left) {
if (m_direction & GestureDirection::Left) {
qreal candidate = -delta.width() / m_triggerDelta.width();
if (candidate > progress) {
progress = candidate;
}
}
if (m_direction & GestureTypeFlag::Right) {
if (m_direction & GestureDirection::Right) {
qreal candidate = delta.width() / m_triggerDelta.width();
if (candidate > progress) {
progress = candidate;
......@@ -185,11 +185,11 @@ int GestureRecognizer::startSwipeGesture(uint fingerCount, const QPointF &startP
// Only add gestures who's direction aligns with current swipe axis
if (m_currentSwipeAxis == Axis::Vertical) {
if (!(gesture->direction() & (GestureTypeFlag::Up | GestureTypeFlag::Down))) {
if (!(gesture->direction() & (GestureDirection::Up | GestureDirection::Down))) {
continue;
}
} else if (m_currentSwipeAxis == Axis::Horizontal) {
if (!(gesture->direction() & (GestureTypeFlag::Left | GestureTypeFlag::Right))) {
if (!(gesture->direction() & (GestureDirection::Left | GestureDirection::Right))) {
continue;
}
}
......@@ -205,17 +205,17 @@ void GestureRecognizer::updateSwipeGesture(const QSizeF &delta)
{
m_currentDelta += delta;
GestureTypeFlag direction; // Overall direction
GestureDirection direction; // Overall direction
Axis swipeAxis;
// Pick an axis for gestures so horizontal ones don't change to vertical ones without lifting fingers
if (m_currentSwipeAxis == Axis::None) {
if (std::abs(m_currentDelta.width()) >= std::abs(m_currentDelta.height())) {
swipeAxis = Axis::Horizontal;
direction = m_currentDelta.width() < 0 ? GestureTypeFlag::Left : GestureTypeFlag::Right;
direction = m_currentDelta.width() < 0 ? GestureDirection::Left : GestureDirection::Right;
} else {
swipeAxis = Axis::Vertical;
direction = m_currentDelta.height() < 0 ? GestureTypeFlag::Up : GestureTypeFlag::Down;
direction = m_currentDelta.height() < 0 ? GestureDirection::Up : GestureDirection::Down;
}
if (std::abs(m_currentDelta.width()) >= 5 || std::abs(m_currentDelta.height()) >= 5) {
// only lock in a direction if the delta is big enough
......@@ -229,10 +229,10 @@ void GestureRecognizer::updateSwipeGesture(const QSizeF &delta)
// Find the current swipe direction
switch (swipeAxis) {
case Axis::Vertical:
direction = m_currentDelta.height() < 0 ? GestureTypeFlag::Up : GestureTypeFlag::Down;
direction = m_currentDelta.height() < 0 ? GestureDirection::Up : GestureDirection::Down;
break;
case Axis::Horizontal:
direction = m_currentDelta.width() < 0 ? GestureTypeFlag::Left : GestureTypeFlag::Right;
direction = m_currentDelta.width() < 0 ? GestureDirection::Left : GestureDirection::Right;
break;
default:
Q_UNREACHABLE();
......@@ -335,11 +335,11 @@ void GestureRecognizer::updatePinchGesture(qreal scale, qreal angleDelta, const
m_currentScale = scale;
// Determine the direction of the swipe
GestureTypeFlag direction;
GestureDirection direction;
if (scale < 1) {
direction = GestureTypeFlag::Contracting;
direction = GestureDirection::Contracting;
} else {
direction = GestureTypeFlag::Expanding;
direction = GestureDirection::Expanding;
}
// Eliminate wrong gestures (takes two iterations)
......@@ -496,25 +496,25 @@ qreal SwipeGesture::getSemanticProgress(const QSizeF &delta) const
{
qreal progress = 0;
if (direction() & GestureTypeFlag::Up) {
if (direction() & GestureDirection::Up) {
qreal val = -delta.height() / m_unitDelta;
if (val > progress) {
progress = val;
}
}
if (direction() & GestureTypeFlag::Down) {
if (direction() & GestureDirection::Down) {
qreal val = delta.height() / m_unitDelta;
if (val > progress) {
progress = val;
}
}
if (direction() & GestureTypeFlag::Left) {
if (direction() & GestureDirection::Left) {
qreal val = -delta.width() / m_unitDelta;
if (val > progress) {
progress = val;
}
}
if (direction() & GestureTypeFlag::Right) {
if (direction() & GestureDirection::Right) {
qreal val = delta.width() / m_unitDelta;
if (val > progress) {
progress = val;
......@@ -552,12 +552,12 @@ QSet<uint> Gesture::acceptableFingerCounts() const
return m_validFingerCounts;
}
GestureType Gesture::direction() const
GestureDirections Gesture::direction() const
{
return m_direction;
}
void Gesture::setDirection(GestureType direction)
void Gesture::setDirection(GestureDirections direction)
{
m_direction = direction;
}
......
......@@ -51,12 +51,12 @@ public:
bool isFingerCountAcceptable(uint fingers) const;
QSet<uint> acceptableFingerCounts() const;
GestureType direction() const;
void setDirection(GestureType direction);
GestureDirections direction() const;
void setDirection(GestureDirections direction);
protected:
explicit Gesture(QObject *parent);
GestureType m_direction;
GestureDirections m_direction;
Q_SIGNALS:
/**
......@@ -83,7 +83,7 @@ Q_SIGNALS:
* Progress is always positive
* It can be more than 1, indicating an action should happen more than once.
*/
void semanticProgress(qreal, GestureType);
void semanticProgress(qreal, GestureDirections);
private:
QSet<uint> m_validFingerCounts = DEFAULT_VALID_FINGER_COUNTS;
......@@ -142,7 +142,7 @@ Q_SIGNALS:
* Summative pixel delta from where the gesture
* started to where it is now.
*/
void pixelDelta(const QSizeF &delta, GestureType);
void pixelDelta(const QSizeF &delta, GestureDirections);
private:
bool m_minimumXRelevant = false;
......
......@@ -123,7 +123,7 @@ void GlobalShortcutsManager::registerAxisShortcut(QAction *action, Qt::KeyboardM
addIfNotExists(GlobalShortcut(PointerAxisShortcut{modifiers, axis}, action));
}
void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureType direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureDirections direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
{
// Create and setup the GestureShortcut
GestureShortcut shortcut{device, direction};
......@@ -148,7 +148,7 @@ void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureTy
addIfNotExists(GlobalShortcut(std::move(shortcut), onUp), device);
}
void GlobalShortcutsManager::forceRegisterTouchscreenSwipe(QAction *onUp, std::function<void(qreal)> progressCallback, GestureTypeFlag direction, uint fingerCount)
void GlobalShortcutsManager::forceRegisterTouchscreenSwipe(QAction *onUp, std::function<void(qreal)> progressCallback, GestureDirection direction, uint fingerCount)
{
std::unique_ptr<SwipeGesture> gesture = std::make_unique<SwipeGesture>();
gesture->addFingerCount(fingerCount);
......
......@@ -59,9 +59,9 @@ public:
*/
void registerAxisShortcut(QAction *action, Qt::KeyboardModifiers modifiers, PointerAxisDirection axis);
void registerGesture(GestureDeviceType device, GestureType direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = nullptr);
void registerGesture(GestureDeviceType device, GestureDirections direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = nullptr);
void forceRegisterTouchscreenSwipe(QAction *action, std::function<void(qreal)> progressCallback, GestureTypeFlag direction, uint fingerCount);
void forceRegisterTouchscreenSwipe(QAction *action, std::function<void(qreal)> progressCallback, GestureDirection direction, uint fingerCount);
/**
* @brief Processes a key event to decide whether a shortcut needs to be triggered.
......@@ -146,7 +146,7 @@ struct PointerAxisShortcut
struct GestureShortcut
{
GestureDeviceType device;
GestureType direction;
GestureDirections direction;
Gesture *gesture() const;
std::unique_ptr<SwipeGesture> swipeGesture;
......
......@@ -3309,7 +3309,7 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi
m_shortcuts->registerAxisShortcut(action, modifiers, axis);
}
void InputRedirection::registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
void InputRedirection::registerGesture(GestureDeviceType device, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
{
m_shortcuts->registerGesture(device, direction, fingerCount, onUp, progressCallback);
}
......@@ -3319,7 +3319,7 @@ void InputRedirection::registerGlobalAccel(KGlobalAccelInterface *interface)
m_shortcuts->setKGlobalAccelInterface(interface);
}
void InputRedirection::forceRegisterTouchscreenSwipeShortcut(GestureTypeFlag direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback)
void InputRedirection::forceRegisterTouchscreenSwipeShortcut(GestureDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback)
{
m_shortcuts->forceRegisterTouchscreenSwipe(action, progressCallback, direction, fingerCount);
}
......
......@@ -136,8 +136,8 @@ public:
void registerShortcut(const QKeySequence &shortcut, QAction *action, T *receiver, Slot slot);
void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action);
void registerAxisShortcut(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, QAction *action);
void registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback);
void forceRegisterTouchscreenSwipeShortcut(GestureTypeFlag direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback);
void registerGesture(GestureDeviceType device, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback);
void forceRegisterTouchscreenSwipeShortcut(GestureDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback);
void registerGlobalAccel(KGlobalAccelInterface *interface);
bool supportsPointerWarping() const;
void warpPointer(const QPointF &pos);
......
......@@ -894,7 +894,7 @@ public:
* @param action The action which gets triggered when the gesture is released
* @since 5.26
*/
virtual void registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = nullptr) = 0;
virtual void registerGesture(GestureDeviceType device, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = nullptr) = 0;
/**
* Retrieve the proxy class for an effect if it has one. Will return NULL if
......
......@@ -225,7 +225,7 @@ inline KWIN_EXPORT QRect infiniteRegion()
* @brief Directions for gestures
* @since 5.25
*/
enum class GestureTypeFlag {
enum class GestureDirection {
Up = 1 << 1,
Down = 1 << 2,
Left = 1 << 3,
......@@ -234,18 +234,18 @@ enum class GestureTypeFlag {
Contracting = 1 << 6,
};
Q_DECLARE_FLAGS(GestureType, GestureTypeFlag)
Q_DECLARE_OPERATORS_FOR_FLAGS(GestureType)
Q_DECLARE_METATYPE(GestureTypeFlag)
Q_DECLARE_FLAGS(GestureDirections, GestureDirection)
Q_DECLARE_OPERATORS_FOR_FLAGS(GestureDirections)
Q_DECLARE_METATYPE(GestureDirection)
inline bool isSwipeDirection(GestureType d)
inline bool isSwipeDirection(GestureDirections d)
{
return d & (GestureTypeFlag::Up | GestureTypeFlag::Down | GestureTypeFlag::Left | GestureTypeFlag::Right);
return d & (GestureDirection::Up | GestureDirection::Down | GestureDirection::Left | GestureDirection::Right);
}
inline bool isPinchDirection(GestureType d)
inline bool isPinchDirection(GestureDirections d)
{
return d & (GestureTypeFlag::Contracting | GestureTypeFlag::Expanding);
return d & (GestureDirection::Contracting | GestureDirection::Expanding);
}
Q_DECLARE_METATYPE(std::chrono::nanoseconds)
......
......@@ -712,16 +712,16 @@ void Edge::setBorder(ElectricBorder border)
m_border = border;
switch (m_border) {
case ElectricTop:
m_gesture->setDirection(GestureTypeFlag::Down);
m_gesture->setDirection(GestureDirection::Down);
break;
case ElectricRight:
m_gesture->setDirection(GestureTypeFlag::Left);
m_gesture->setDirection(GestureDirection::Left);
break;
case ElectricBottom:
m_gesture->setDirection(GestureTypeFlag::Up);
m_gesture->setDirection(GestureDirection::Up);
break;
case ElectricLeft:
m_gesture->setDirection(GestureTypeFlag::Right);
m_gesture->setDirection(GestureDirection::Right);
break;
default:
break;
......
......@@ -821,24 +821,24 @@ void VirtualDesktopManager::initShortcuts()
Q_EMIT currentChanging(current(), m_currentDesktopOffset);
}
};
input()->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Left, 3, m_swipeGestureReleasedX.get(), left);
input()->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Right, 3, m_swipeGestureReleasedX.get(), right);
input()->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Left, 4, m_swipeGestureReleasedX.get(), left);
input()->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Right, 4, m_swipeGestureReleasedX.get(), right);
input()->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Down, 3, m_swipeGestureReleasedY.get(), [this](qreal cb) {
input()->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Left, 3, m_swipeGestureReleasedX.get(), left);
input()->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Right, 3, m_swipeGestureReleasedX.get(), right);
input()->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Left, 4, m_swipeGestureReleasedX.get(), left);
input()->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Right, 4, m_swipeGestureReleasedX.get(), right);
input()->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Down, 3, m_swipeGestureReleasedY.get(), [this](qreal cb) {
if (grid().height() > 1) {
m_currentDesktopOffset.setY(-cb);
Q_EMIT currentChanging(current(), m_currentDesktopOffset);
}
});
input()->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Up, 3, m_swipeGestureReleasedY.get(), [this](qreal cb) {
input()->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Up, 3, m_swipeGestureReleasedY.get(), [this](qreal cb) {
if (grid().height() > 1) {
m_currentDesktopOffset.setY(cb);
Q_EMIT currentChanging(current(), m_currentDesktopOffset);
}
});
input()->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Left, 3, m_swipeGestureReleasedX.get(), left);
input()->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Right, 3, m_swipeGestureReleasedX.get(), right);
input()->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Left, 3, m_swipeGestureReleasedX.get(), left);
input()->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Right, 3, m_swipeGestureReleasedX.get(), right);
// axis events
input()->registerAxisShortcut(Qt::ControlModifier | Qt::AltModifier, PointerAxisDown,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment