diff --git a/autotests/integration/touch_input_test.cpp b/autotests/integration/touch_input_test.cpp index b2e9a9ae13..d60a895239 100644 --- a/autotests/integration/touch_input_test.cpp +++ b/autotests/integration/touch_input_test.cpp @@ -378,7 +378,7 @@ void TouchInputTest::testGestureDetection() qWarning() << "progress callback!" << progress; }; QAction action; - input()->forceRegisterTouchscreenSwipeShortcut(GestureDirection::Right, 3, &action, callback); + input()->forceRegisterTouchscreenSwipeShortcut(GestureTypeFlag::Right, 3, &action, callback); // verify that gestures are detected diff --git a/autotests/test_gestures.cpp b/autotests/test_gestures.cpp index 1900727f31..9ae25b9b29 100644 --- a/autotests/test_gestures.cpp +++ b/autotests/test_gestures.cpp @@ -54,26 +54,26 @@ private Q_SLOTS: void GestureTest::testDirection_data() { - QTest::addColumn("direction"); + QTest::addColumn("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; + 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; } void GestureTest::testDirection() { SwipeGesture gesture; QCOMPARE(gesture.direction(), 0); - QFETCH(GestureDirection, direction); + QFETCH(GestureTypeFlag, direction); gesture.setDirection(direction); QCOMPARE(gesture.direction(), direction); // back to down - gesture.setDirection(GestureDirection::Down); - QCOMPARE(gesture.direction(), GestureDirection::Down); + gesture.setDirection(GestureTypeFlag::Down); + QCOMPARE(gesture.direction(), GestureTypeFlag::Down); } void GestureTest::testMinimumX_data() @@ -231,19 +231,19 @@ void GestureTest::testDeleteSwipeCancels() void GestureTest::testSwipeCancel_data() { - QTest::addColumn("direction"); + QTest::addColumn("direction"); - QTest::newRow("Up") << GestureDirection::Up; - QTest::newRow("Left") << GestureDirection::Left; - QTest::newRow("Right") << GestureDirection::Right; - QTest::newRow("Down") << GestureDirection::Down; + QTest::newRow("Up") << GestureTypeFlag::Up; + QTest::newRow("Left") << GestureTypeFlag::Left; + QTest::newRow("Right") << GestureTypeFlag::Right; + QTest::newRow("Down") << GestureTypeFlag::Down; } void GestureTest::testSwipeCancel() { GestureRecognizer recognizer; std::unique_ptr gesture(new SwipeGesture); - QFETCH(GestureDirection, direction); + QFETCH(GestureTypeFlag, direction); gesture->setDirection(direction); QSignalSpy startedSpy(gesture.get(), &SwipeGesture::started); @@ -264,20 +264,20 @@ void GestureTest::testSwipeCancel() void GestureTest::testSwipeUpdateTrigger_data() { - QTest::addColumn("direction"); + QTest::addColumn("direction"); QTest::addColumn("delta"); - 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); + 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); } void GestureTest::testSwipeUpdateTrigger() { GestureRecognizer recognizer; SwipeGesture gesture; - QFETCH(GestureDirection, direction); + QFETCH(GestureTypeFlag, direction); gesture.setDirection(direction); gesture.setTriggerDelta(QSizeF(1, 1)); @@ -333,11 +333,11 @@ void GestureTest::testNotEmitCallbacksBeforeDirectionDecided() SwipeGesture right; PinchGesture expand; PinchGesture contract; - up.setDirection(GestureDirection::Up); - down.setDirection(GestureDirection::Down); - right.setDirection(GestureDirection::Right); - expand.setDirection(GestureDirection::Expanding); - contract.setDirection(GestureDirection::Contracting); + up.setDirection(GestureTypeFlag::Up); + down.setDirection(GestureTypeFlag::Down); + right.setDirection(GestureTypeFlag::Right); + expand.setDirection(GestureTypeFlag::Expanding); + contract.setDirection(GestureTypeFlag::Contracting); recognizer.registerSwipeGesture(&up); recognizer.registerSwipeGesture(&down); recognizer.registerSwipeGesture(&right); diff --git a/autotests/test_virtual_desktops.cpp b/autotests/test_virtual_desktops.cpp index 1bc494d7f2..590fe9f766 100644 --- a/autotests/test_virtual_desktops.cpp +++ b/autotests/test_virtual_desktops.cpp @@ -32,7 +32,7 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi Q_UNUSED(action) } -void InputRedirection::registerGesture(GestureDeviceType, GestureDirection, uint, QAction *, std::function) +void InputRedirection::registerGesture(GestureDeviceType, GestureTypeFlag, uint, QAction *, std::function) { } } diff --git a/src/effects.cpp b/src/effects.cpp index 38a801c5b3..35baa0c348 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -816,7 +816,7 @@ void EffectsHandlerImpl::registerAxisShortcut(Qt::KeyboardModifiers modifiers, P input()->registerAxisShortcut(modifiers, axis, action); } -void EffectsHandlerImpl::registerGesture(GestureDeviceType device, GestureDirection direction, uint fingerCount, QAction *onUp, std::function progressCallback) +void EffectsHandlerImpl::registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function progressCallback) { input()->registerGesture(device, direction, fingerCount, onUp, progressCallback); } diff --git a/src/effects.h b/src/effects.h index ac2562c336..dd13e8ed70 100644 --- a/src/effects.h +++ b/src/effects.h @@ -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, GestureDirection direction, uint fingerCount, QAction *onUp, std::function progressCallback) override; + void registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function progressCallback) override; void *getProxy(QString name) override; void startMousePolling() override; diff --git a/src/effects/desktopgrid/desktopgrideffect.cpp b/src/effects/desktopgrid/desktopgrideffect.cpp index 577f5816ea..46e832269e 100644 --- a/src/effects/desktopgrid/desktopgrideffect.cpp +++ b/src/effects/desktopgrid/desktopgrideffect.cpp @@ -61,7 +61,7 @@ DesktopGridEffect::DesktopGridEffect() } }); - effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Up, 4, m_realtimeToggleAction, [this](qreal progress) { + effects->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Up, 4, m_realtimeToggleAction, [this](qreal progress) { progress = std::clamp(progress, 0.0, 1.0); if (!effects->hasActiveFullScreenEffect() || effects->activeFullScreenEffect() == this) { switch (m_status) { diff --git a/src/effects/overview/overvieweffect.cpp b/src/effects/overview/overvieweffect.cpp index 5a5cd6c2fe..d1a49b965b 100644 --- a/src/effects/overview/overvieweffect.cpp +++ b/src/effects/overview/overvieweffect.cpp @@ -67,8 +67,8 @@ OverviewEffect::OverviewEffect() } }; - effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Contracting, 4, m_realtimeToggleAction, progressCallback); - effects->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Up, 3, m_realtimeToggleAction, progressCallback); + effects->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Contracting, 4, m_realtimeToggleAction, progressCallback); + effects->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Up, 3, m_realtimeToggleAction, progressCallback); connect(effects, &EffectsHandler::screenAboutToLock, this, &OverviewEffect::realDeactivate); diff --git a/src/effects/windowview/windowvieweffect.cpp b/src/effects/windowview/windowvieweffect.cpp index b07eaead12..68105766bc 100644 --- a/src/effects/windowview/windowvieweffect.cpp +++ b/src/effects/windowview/windowvieweffect.cpp @@ -126,8 +126,8 @@ WindowViewEffect::WindowViewEffect() } } }; - effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Down, 4, m_realtimeToggleAction, gestureCallback); - effects->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Down, 3, m_realtimeToggleAction, gestureCallback); + effects->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::Down, 4, m_realtimeToggleAction, gestureCallback); + effects->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Down, 3, m_realtimeToggleAction, gestureCallback); reconfigure(ReconfigureAll); } diff --git a/src/gestures.cpp b/src/gestures.cpp index ce7351e9af..866de8d967 100644 --- a/src/gestures.cpp +++ b/src/gestures.cpp @@ -49,25 +49,25 @@ qreal SwipeGesture::getTriggerProgress(const QSizeF &delta) const qreal progress = 0.0; - if (m_direction & GestureDirection::Up) { + if (m_direction & GestureTypeFlag::Up) { qreal candidate = -delta.height() / m_triggerDelta.height(); if (candidate > progress) { progress = candidate; } } - if (m_direction & GestureDirection::Down) { + if (m_direction & GestureTypeFlag::Down) { qreal candidate = delta.height() / m_triggerDelta.height(); if (candidate > progress) { progress = candidate; } } - if (m_direction & GestureDirection::Left) { + if (m_direction & GestureTypeFlag::Left) { qreal candidate = -delta.width() / m_triggerDelta.width(); if (candidate > progress) { progress = candidate; } } - if (m_direction & GestureDirection::Right) { + if (m_direction & GestureTypeFlag::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() & (GestureDirection::Up | GestureDirection::Down))) { + if (!(gesture->direction() & (GestureTypeFlag::Up | GestureTypeFlag::Down))) { continue; } } else if (m_currentSwipeAxis == Axis::Horizontal) { - if (!(gesture->direction() & (GestureDirection::Left | GestureDirection::Right))) { + if (!(gesture->direction() & (GestureTypeFlag::Left | GestureTypeFlag::Right))) { continue; } } @@ -205,17 +205,17 @@ void GestureRecognizer::updateSwipeGesture(const QSizeF &delta) { m_currentDelta += delta; - GestureDirection direction; // Overall direction + GestureTypeFlag 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 ? GestureDirection::Left : GestureDirection::Right; + direction = m_currentDelta.width() < 0 ? GestureTypeFlag::Left : GestureTypeFlag::Right; } else { swipeAxis = Axis::Vertical; - direction = m_currentDelta.height() < 0 ? GestureDirection::Up : GestureDirection::Down; + direction = m_currentDelta.height() < 0 ? GestureTypeFlag::Up : GestureTypeFlag::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 ? GestureDirection::Up : GestureDirection::Down; + direction = m_currentDelta.height() < 0 ? GestureTypeFlag::Up : GestureTypeFlag::Down; break; case Axis::Horizontal: - direction = m_currentDelta.width() < 0 ? GestureDirection::Left : GestureDirection::Right; + direction = m_currentDelta.width() < 0 ? GestureTypeFlag::Left : GestureTypeFlag::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 - GestureDirection direction; + GestureTypeFlag direction; if (scale < 1) { - direction = GestureDirection::Contracting; + direction = GestureTypeFlag::Contracting; } else { - direction = GestureDirection::Expanding; + direction = GestureTypeFlag::Expanding; } // Eliminate wrong gestures (takes two iterations) @@ -496,25 +496,25 @@ qreal SwipeGesture::getSemanticProgress(const QSizeF &delta) const { qreal progress = 0; - if (direction() & GestureDirection::Up) { + if (direction() & GestureTypeFlag::Up) { qreal val = -delta.height() / m_unitDelta; if (val > progress) { progress = val; } } - if (direction() & GestureDirection::Down) { + if (direction() & GestureTypeFlag::Down) { qreal val = delta.height() / m_unitDelta; if (val > progress) { progress = val; } } - if (direction() & GestureDirection::Left) { + if (direction() & GestureTypeFlag::Left) { qreal val = -delta.width() / m_unitDelta; if (val > progress) { progress = val; } } - if (direction() & GestureDirection::Right) { + if (direction() & GestureTypeFlag::Right) { qreal val = delta.width() / m_unitDelta; if (val > progress) { progress = val; @@ -552,12 +552,12 @@ QSet Gesture::acceptableFingerCounts() const return m_validFingerCounts; } -GestureDirections Gesture::direction() const +GestureType Gesture::direction() const { return m_direction; } -void Gesture::setDirection(GestureDirections direction) +void Gesture::setDirection(GestureType direction) { m_direction = direction; } diff --git a/src/gestures.h b/src/gestures.h index 987066ee7c..901790971b 100644 --- a/src/gestures.h +++ b/src/gestures.h @@ -51,12 +51,12 @@ public: bool isFingerCountAcceptable(uint fingers) const; QSet acceptableFingerCounts() const; - GestureDirections direction() const; - void setDirection(GestureDirections direction); + GestureType direction() const; + void setDirection(GestureType direction); protected: explicit Gesture(QObject *parent); - GestureDirections m_direction; + GestureType 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, GestureDirections); + void semanticProgress(qreal, GestureType); private: QSet 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, GestureDirections); + void pixelDelta(const QSizeF &delta, GestureType); private: bool m_minimumXRelevant = false; diff --git a/src/globalshortcuts.cpp b/src/globalshortcuts.cpp index dc9b4bf321..3c10e4b1e3 100644 --- a/src/globalshortcuts.cpp +++ b/src/globalshortcuts.cpp @@ -123,7 +123,7 @@ void GlobalShortcutsManager::registerAxisShortcut(QAction *action, Qt::KeyboardM addIfNotExists(GlobalShortcut(PointerAxisShortcut{modifiers, axis}, action)); } -void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureDirections direction, uint fingerCount, QAction *onUp, std::function progressCallback) +void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureType direction, uint fingerCount, QAction *onUp, std::function progressCallback) { // Create and setup the GestureShortcut GestureShortcut shortcut{device, direction}; @@ -148,7 +148,7 @@ void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureDi addIfNotExists(GlobalShortcut(std::move(shortcut), onUp), device); } -void GlobalShortcutsManager::forceRegisterTouchscreenSwipe(QAction *onUp, std::function progressCallback, GestureDirection direction, uint fingerCount) +void GlobalShortcutsManager::forceRegisterTouchscreenSwipe(QAction *onUp, std::function progressCallback, GestureTypeFlag direction, uint fingerCount) { std::unique_ptr gesture = std::make_unique(); gesture->addFingerCount(fingerCount); diff --git a/src/globalshortcuts.h b/src/globalshortcuts.h index 5f6b432fae..eb814e8f2c 100644 --- a/src/globalshortcuts.h +++ b/src/globalshortcuts.h @@ -59,9 +59,9 @@ public: */ void registerAxisShortcut(QAction *action, Qt::KeyboardModifiers modifiers, PointerAxisDirection axis); - void registerGesture(GestureDeviceType device, GestureDirections direction, uint fingerCount, QAction *onUp, std::function progressCallback = nullptr); + void registerGesture(GestureDeviceType device, GestureType direction, uint fingerCount, QAction *onUp, std::function progressCallback = nullptr); - void forceRegisterTouchscreenSwipe(QAction *action, std::function progressCallback, GestureDirection direction, uint fingerCount); + void forceRegisterTouchscreenSwipe(QAction *action, std::function progressCallback, GestureTypeFlag 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; - GestureDirections direction; + GestureType direction; Gesture *gesture() const; std::unique_ptr swipeGesture; diff --git a/src/input.cpp b/src/input.cpp index 61753d2579..2512de55cd 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -3309,7 +3309,7 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi m_shortcuts->registerAxisShortcut(action, modifiers, axis); } -void InputRedirection::registerGesture(GestureDeviceType device, GestureDirection direction, uint fingerCount, QAction *onUp, std::function progressCallback) +void InputRedirection::registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function 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(GestureDirection direction, uint fingerCount, QAction *action, std::function progressCallback) +void InputRedirection::forceRegisterTouchscreenSwipeShortcut(GestureTypeFlag direction, uint fingerCount, QAction *action, std::function progressCallback) { m_shortcuts->forceRegisterTouchscreenSwipe(action, progressCallback, direction, fingerCount); } diff --git a/src/input.h b/src/input.h index 4f1d8bdcf7..70c3d15e57 100644 --- a/src/input.h +++ b/src/input.h @@ -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, GestureDirection direction, uint fingerCount, QAction *onUp, std::function progressCallback); - void forceRegisterTouchscreenSwipeShortcut(GestureDirection direction, uint fingerCount, QAction *action, std::function progressCallback); + void registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function progressCallback); + void forceRegisterTouchscreenSwipeShortcut(GestureTypeFlag direction, uint fingerCount, QAction *action, std::function progressCallback); void registerGlobalAccel(KGlobalAccelInterface *interface); bool supportsPointerWarping() const; void warpPointer(const QPointF &pos); diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index 003f923f1d..a84079ace2 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -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, GestureDirection direction, uint fingerCount, QAction *onUp, std::function progressCallback = nullptr) = 0; + virtual void registerGesture(GestureDeviceType device, GestureTypeFlag direction, uint fingerCount, QAction *onUp, std::function progressCallback = nullptr) = 0; /** * Retrieve the proxy class for an effect if it has one. Will return NULL if diff --git a/src/libkwineffects/kwinglobals.h b/src/libkwineffects/kwinglobals.h index a84cef0626..6a1cedfc93 100644 --- a/src/libkwineffects/kwinglobals.h +++ b/src/libkwineffects/kwinglobals.h @@ -225,7 +225,7 @@ inline KWIN_EXPORT QRect infiniteRegion() * @brief Directions for gestures * @since 5.25 */ -enum class GestureDirection { +enum class GestureTypeFlag { Up = 1 << 1, Down = 1 << 2, Left = 1 << 3, @@ -234,18 +234,18 @@ enum class GestureDirection { Contracting = 1 << 6, }; -Q_DECLARE_FLAGS(GestureDirections, GestureDirection) -Q_DECLARE_OPERATORS_FOR_FLAGS(GestureDirections) -Q_DECLARE_METATYPE(GestureDirection) +Q_DECLARE_FLAGS(GestureType, GestureTypeFlag) +Q_DECLARE_OPERATORS_FOR_FLAGS(GestureType) +Q_DECLARE_METATYPE(GestureTypeFlag) -inline bool isSwipeDirection(GestureDirections d) +inline bool isSwipeDirection(GestureType d) { - return d & (GestureDirection::Up | GestureDirection::Down | GestureDirection::Left | GestureDirection::Right); + return d & (GestureTypeFlag::Up | GestureTypeFlag::Down | GestureTypeFlag::Left | GestureTypeFlag::Right); } -inline bool isPinchDirection(GestureDirections d) +inline bool isPinchDirection(GestureType d) { - return d & (GestureDirection::Contracting | GestureDirection::Expanding); + return d & (GestureTypeFlag::Contracting | GestureTypeFlag::Expanding); } Q_DECLARE_METATYPE(std::chrono::nanoseconds) diff --git a/src/screenedge.cpp b/src/screenedge.cpp index 000531ac4a..61ee6e9256 100644 --- a/src/screenedge.cpp +++ b/src/screenedge.cpp @@ -712,16 +712,16 @@ void Edge::setBorder(ElectricBorder border) m_border = border; switch (m_border) { case ElectricTop: - m_gesture->setDirection(GestureDirection::Down); + m_gesture->setDirection(GestureTypeFlag::Down); break; case ElectricRight: - m_gesture->setDirection(GestureDirection::Left); + m_gesture->setDirection(GestureTypeFlag::Left); break; case ElectricBottom: - m_gesture->setDirection(GestureDirection::Up); + m_gesture->setDirection(GestureTypeFlag::Up); break; case ElectricLeft: - m_gesture->setDirection(GestureDirection::Right); + m_gesture->setDirection(GestureTypeFlag::Right); break; default: break; diff --git a/src/virtualdesktops.cpp b/src/virtualdesktops.cpp index 180b37c37e..f6143ed1d5 100644 --- a/src/virtualdesktops.cpp +++ b/src/virtualdesktops.cpp @@ -821,24 +821,24 @@ void VirtualDesktopManager::initShortcuts() Q_EMIT currentChanging(current(), m_currentDesktopOffset); } }; - 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) { + 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) { if (grid().height() > 1) { m_currentDesktopOffset.setY(-cb); Q_EMIT currentChanging(current(), m_currentDesktopOffset); } }); - input()->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Up, 3, m_swipeGestureReleasedY.get(), [this](qreal cb) { + input()->registerGesture(GestureDeviceType::Touchpad, GestureTypeFlag::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, GestureDirection::Left, 3, m_swipeGestureReleasedX.get(), left); - input()->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Right, 3, m_swipeGestureReleasedX.get(), right); + input()->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Left, 3, m_swipeGestureReleasedX.get(), left); + input()->registerGesture(GestureDeviceType::Touchscreen, GestureTypeFlag::Right, 3, m_swipeGestureReleasedX.get(), right); // axis events input()->registerAxisShortcut(Qt::ControlModifier | Qt::AltModifier, PointerAxisDown,