Commit 38600a62 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Revert "Merge gesture structs/enums"

This reverts commit d29c7a6c.

It was pushed with unreviewed changes and not fully resolved issues.
parent db1ec66e
Pipeline #230367 failed with stage
in 17 minutes and 29 seconds
......@@ -24,7 +24,6 @@ set(testVirtualDesktops_SRCS
add_executable(testVirtualDesktops ${testVirtualDesktops_SRCS})
target_link_libraries(testVirtualDesktops
kwineffects
kwin
Qt::Test
......@@ -170,7 +169,6 @@ set(testGestures_SRCS
add_executable(testGestures ${testGestures_SRCS})
target_link_libraries(testGestures
kwineffects
Qt::Test
)
......
......@@ -378,7 +378,7 @@ void TouchInputTest::testGestureDetection()
qWarning() << "progress callback!" << progress;
};
QAction action;
input()->forceRegisterTouchscreenSwipeShortcut(GestureDirection::Right, 3, &action, callback);
input()->forceRegisterTouchscreenSwipeShortcut(SwipeDirection::Right, 3, &action, callback);
// verify that gestures are detected
......
......@@ -19,6 +19,16 @@ class GestureTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testSwipeMinFinger_data();
void testSwipeMinFinger();
void testPinchMinFinger_data();
void testPinchMinFinger();
void testSwipeMaxFinger_data();
void testSwipeMaxFinger();
void testPinchMaxFinger_data();
void testPinchMaxFinger();
void testSwipeDirection_data();
void testSwipeDirection();
void testPinchDirection_data();
......@@ -36,6 +46,10 @@ private Q_SLOTS:
void testStartGeometry();
// swipe and pinch
void testSetMinimumDelta();
void testMinimumDeltaReached_data();
void testMinimumDeltaReached();
void testMinimumScaleDelta();
void testUnregisterSwipeCancels();
void testUnregisterPinchCancels();
void testDeleteSwipeCancels();
......@@ -45,8 +59,10 @@ private Q_SLOTS:
void testSwipeUpdateTrigger();
// both
void testSwipeFingerCount_data();
void testSwipeFingerCount();
void testSwipeMinFingerStart_data();
void testSwipeMinFingerStart();
void testSwipeMaxFingerStart_data();
void testSwipeMaxFingerStart();
void testNotEmitCallbacksBeforeDirectionDecided();
// swipe only
......@@ -54,46 +70,142 @@ private Q_SLOTS:
void testSwipeGeometryStart();
};
void GestureTest::testSwipeMinFinger_data()
{
QTest::addColumn<uint>("count");
QTest::addColumn<uint>("expectedCount");
QTest::newRow("0") << 0u << 0u;
QTest::newRow("1") << 1u << 1u;
QTest::newRow("10") << 10u << 10u;
}
void GestureTest::testSwipeMinFinger()
{
SwipeGesture swipeGesture;
QCOMPARE(swipeGesture.minimumFingerCountIsRelevant(), false);
QCOMPARE(swipeGesture.minimumFingerCount(), 0u);
QFETCH(uint, count);
swipeGesture.setMinimumFingerCount(count);
QCOMPARE(swipeGesture.minimumFingerCountIsRelevant(), true);
QTEST(swipeGesture.minimumFingerCount(), "expectedCount");
swipeGesture.setMinimumFingerCount(0);
QCOMPARE(swipeGesture.minimumFingerCountIsRelevant(), true);
QCOMPARE(swipeGesture.minimumFingerCount(), 0u);
}
void GestureTest::testPinchMinFinger_data()
{
QTest::addColumn<uint>("count");
QTest::addColumn<uint>("expectedCount");
QTest::newRow("0") << 0u << 0u;
QTest::newRow("1") << 1u << 1u;
QTest::newRow("10") << 10u << 10u;
}
void GestureTest::testPinchMinFinger()
{
PinchGesture pinchGesture;
QCOMPARE(pinchGesture.minimumFingerCountIsRelevant(), false);
QCOMPARE(pinchGesture.minimumFingerCount(), 0u);
QFETCH(uint, count);
pinchGesture.setMinimumFingerCount(count);
QCOMPARE(pinchGesture.minimumFingerCountIsRelevant(), true);
QTEST(pinchGesture.minimumFingerCount(), "expectedCount");
pinchGesture.setMinimumFingerCount(0);
QCOMPARE(pinchGesture.minimumFingerCountIsRelevant(), true);
QCOMPARE(pinchGesture.minimumFingerCount(), 0u);
}
void GestureTest::testSwipeMaxFinger_data()
{
QTest::addColumn<uint>("count");
QTest::addColumn<uint>("expectedCount");
QTest::newRow("0") << 0u << 0u;
QTest::newRow("1") << 1u << 1u;
QTest::newRow("10") << 10u << 10u;
}
void GestureTest::testSwipeMaxFinger()
{
SwipeGesture gesture;
QCOMPARE(gesture.maximumFingerCountIsRelevant(), false);
QCOMPARE(gesture.maximumFingerCount(), 0u);
QFETCH(uint, count);
gesture.setMaximumFingerCount(count);
QCOMPARE(gesture.maximumFingerCountIsRelevant(), true);
QTEST(gesture.maximumFingerCount(), "expectedCount");
gesture.setMaximumFingerCount(0);
QCOMPARE(gesture.maximumFingerCountIsRelevant(), true);
QCOMPARE(gesture.maximumFingerCount(), 0u);
}
void GestureTest::testPinchMaxFinger_data()
{
QTest::addColumn<uint>("count");
QTest::addColumn<uint>("expectedCount");
QTest::newRow("0") << 0u << 0u;
QTest::newRow("1") << 1u << 1u;
QTest::newRow("10") << 10u << 10u;
}
void GestureTest::testPinchMaxFinger()
{
PinchGesture gesture;
QCOMPARE(gesture.maximumFingerCountIsRelevant(), false);
QCOMPARE(gesture.maximumFingerCount(), 0u);
QFETCH(uint, count);
gesture.setMaximumFingerCount(count);
QCOMPARE(gesture.maximumFingerCountIsRelevant(), true);
QTEST(gesture.maximumFingerCount(), "expectedCount");
gesture.setMaximumFingerCount(0);
QCOMPARE(gesture.maximumFingerCountIsRelevant(), true);
QCOMPARE(gesture.maximumFingerCount(), 0u);
}
void GestureTest::testSwipeDirection_data()
{
QTest::addColumn<GestureDirection>("swipe_direction");
QTest::addColumn<KWin::SwipeGesture::Direction>("swipe_direction");
QTest::newRow("Up") << GestureDirection::Up;
QTest::newRow("Left") << GestureDirection::Left;
QTest::newRow("Right") << GestureDirection::Right;
QTest::newRow("Down") << GestureDirection::Down;
QTest::newRow("Up") << KWin::SwipeGesture::Direction::Up;
QTest::newRow("Left") << KWin::SwipeGesture::Direction::Left;
QTest::newRow("Right") << KWin::SwipeGesture::Direction::Right;
QTest::newRow("Down") << KWin::SwipeGesture::Direction::Down;
}
void GestureTest::testSwipeDirection()
{
SwipeGesture gesture;
QCOMPARE(gesture.direction(), GestureDirection::Down);
QFETCH(GestureDirection, swipe_direction);
QCOMPARE(gesture.direction(), SwipeGesture::Direction::Down);
QFETCH(KWin::SwipeGesture::Direction, swipe_direction);
gesture.setDirection(swipe_direction);
QCOMPARE(gesture.direction(), swipe_direction);
// back to down
gesture.setDirection(GestureDirection::Down);
QCOMPARE(gesture.direction(), GestureDirection::Down);
gesture.setDirection(SwipeGesture::Direction::Down);
QCOMPARE(gesture.direction(), SwipeGesture::Direction::Down);
}
void GestureTest::testPinchDirection_data()
{
QTest::addColumn<GestureDirection>("pinch_direction");
QTest::addColumn<KWin::PinchGesture::Direction>("pinch_direction");
QTest::newRow("Contracting") << GestureDirection::Contracting;
QTest::newRow("Expanding") << GestureDirection::Expanding;
QTest::newRow("Contracting") << KWin::PinchGesture::Direction::Contracting;
QTest::newRow("Expanding") << KWin::PinchGesture::Direction::Expanding;
}
void GestureTest::testPinchDirection()
{
PinchGesture gesture;
QCOMPARE(gesture.direction(), GestureDirection::Expanding);
QFETCH(GestureDirection, pinch_direction);
QCOMPARE(gesture.direction(), PinchGesture::Direction::Expanding);
QFETCH(KWin::PinchGesture::Direction, pinch_direction);
gesture.setDirection(pinch_direction);
QCOMPARE(gesture.direction(), pinch_direction);
// back to down
gesture.setDirection(GestureDirection::Expanding);
QCOMPARE(gesture.direction(), GestureDirection::Expanding);
gesture.setDirection(PinchGesture::Direction::Expanding);
QCOMPARE(gesture.direction(), PinchGesture::Direction::Expanding);
}
void GestureTest::testMinimumX_data()
......@@ -190,6 +302,127 @@ void GestureTest::testStartGeometry()
QCOMPARE(gesture.maximumY(), 32);
}
void GestureTest::testSetMinimumDelta()
{
SwipeGesture swipeGesture;
QCOMPARE(swipeGesture.isMinimumDeltaRelevant(), false);
QCOMPARE(swipeGesture.minimumDelta(), QSizeF());
QCOMPARE(swipeGesture.minimumDeltaReached(QSizeF()), true);
swipeGesture.setMinimumDelta(QSizeF(2, 3));
QCOMPARE(swipeGesture.isMinimumDeltaRelevant(), true);
QCOMPARE(swipeGesture.minimumDelta(), QSizeF(2, 3));
QCOMPARE(swipeGesture.minimumDeltaReached(QSizeF()), false);
QCOMPARE(swipeGesture.minimumDeltaReached(QSizeF(2, 3)), true);
PinchGesture pinchGesture;
QCOMPARE(pinchGesture.isMinimumScaleDeltaRelevant(), false);
QCOMPARE(pinchGesture.minimumScaleDelta(), DEFAULT_UNIT_SCALE_DELTA);
QCOMPARE(pinchGesture.minimumScaleDeltaReached(1.25), true);
pinchGesture.setMinimumScaleDelta(.5);
QCOMPARE(pinchGesture.isMinimumScaleDeltaRelevant(), true);
QCOMPARE(pinchGesture.minimumScaleDelta(), .5);
QCOMPARE(pinchGesture.minimumScaleDeltaReached(1.24), false);
QCOMPARE(pinchGesture.minimumScaleDeltaReached(1.5), true);
}
void GestureTest::testMinimumDeltaReached_data()
{
QTest::addColumn<KWin::SwipeGesture::Direction>("direction");
QTest::addColumn<QSizeF>("minimumDelta");
QTest::addColumn<QSizeF>("delta");
QTest::addColumn<bool>("reached");
QTest::addColumn<qreal>("progress");
QTest::newRow("Up (more)") << KWin::SwipeGesture::Direction::Up << QSizeF(0, -30) << QSizeF(0, -40) << true << 1.0;
QTest::newRow("Up (exact)") << KWin::SwipeGesture::Direction::Up << QSizeF(0, -30) << QSizeF(0, -30) << true << 1.0;
QTest::newRow("Up (less)") << KWin::SwipeGesture::Direction::Up << QSizeF(0, -30) << QSizeF(0, -29) << false << 29.0 / 30.0;
QTest::newRow("Left (more)") << KWin::SwipeGesture::Direction::Left << QSizeF(-30, -30) << QSizeF(-40, 20) << true << 1.0;
QTest::newRow("Left (exact)") << KWin::SwipeGesture::Direction::Left << QSizeF(-30, -40) << QSizeF(-30, 0) << true << 1.0;
QTest::newRow("Left (less)") << KWin::SwipeGesture::Direction::Left << QSizeF(-30, -30) << QSizeF(-29, 0) << false << 29.0 / 30.0;
QTest::newRow("Right (more)") << KWin::SwipeGesture::Direction::Right << QSizeF(30, -30) << QSizeF(40, 20) << true << 1.0;
QTest::newRow("Right (exact)") << KWin::SwipeGesture::Direction::Right << QSizeF(30, -40) << QSizeF(30, 0) << true << 1.0;
QTest::newRow("Right (less)") << KWin::SwipeGesture::Direction::Right << QSizeF(30, -30) << QSizeF(29, 0) << false << 29.0 / 30.0;
QTest::newRow("Down (more)") << KWin::SwipeGesture::Direction::Down << QSizeF(0, 30) << QSizeF(0, 40) << true << 1.0;
QTest::newRow("Down (exact)") << KWin::SwipeGesture::Direction::Down << QSizeF(0, 30) << QSizeF(0, 30) << true << 1.0;
QTest::newRow("Down (less)") << KWin::SwipeGesture::Direction::Down << QSizeF(0, 30) << QSizeF(0, 29) << false << 29.0 / 30.0;
}
void GestureTest::testMinimumDeltaReached()
{
GestureRecognizer recognizer;
// swipe gesture
SwipeGesture gesture;
QFETCH(SwipeGesture::Direction, direction);
gesture.setDirection(direction);
QFETCH(QSizeF, minimumDelta);
gesture.setMinimumDelta(minimumDelta);
QFETCH(QSizeF, delta);
QFETCH(bool, reached);
QCOMPARE(gesture.minimumDeltaReached(delta), reached);
recognizer.registerSwipeGesture(&gesture);
QSignalSpy startedSpy(&gesture, &SwipeGesture::started);
QVERIFY(startedSpy.isValid());
QSignalSpy triggeredSpy(&gesture, &SwipeGesture::triggered);
QVERIFY(triggeredSpy.isValid());
QSignalSpy cancelledSpy(&gesture, &SwipeGesture::cancelled);
QVERIFY(cancelledSpy.isValid());
QSignalSpy progressSpy(&gesture, &SwipeGesture::progress);
QVERIFY(progressSpy.isValid());
recognizer.startSwipeGesture(1);
QCOMPARE(startedSpy.count(), 1);
QCOMPARE(triggeredSpy.count(), 0);
QCOMPARE(cancelledSpy.count(), 0);
QCOMPARE(progressSpy.count(), 0);
recognizer.updateSwipeGesture(delta);
QCOMPARE(startedSpy.count(), 1);
QCOMPARE(triggeredSpy.count(), 0);
QCOMPARE(cancelledSpy.count(), 0);
QCOMPARE(progressSpy.count(), 1);
QTEST(progressSpy.first().first().value<qreal>(), "progress");
recognizer.endSwipeGesture();
QCOMPARE(startedSpy.count(), 1);
QCOMPARE(progressSpy.count(), 1);
QCOMPARE(triggeredSpy.isEmpty(), !reached);
QCOMPARE(cancelledSpy.isEmpty(), reached);
}
void GestureTest::testMinimumScaleDelta()
{
// pinch gesture
PinchGesture gesture;
gesture.setDirection(PinchGesture::Direction::Contracting);
gesture.setMinimumScaleDelta(.5);
gesture.setMinimumFingerCount(3);
gesture.setMaximumFingerCount(4);
QCOMPARE(gesture.minimumScaleDeltaReached(1.25), false);
QCOMPARE(gesture.minimumScaleDeltaReached(1.5), true);
GestureRecognizer recognizer;
recognizer.registerPinchGesture(&gesture);
QSignalSpy startedSpy(&gesture, &PinchGesture::started);
QVERIFY(startedSpy.isValid());
QSignalSpy triggeredSpy(&gesture, &PinchGesture::triggered);
QVERIFY(triggeredSpy.isValid());
QSignalSpy cancelledSpy(&gesture, &PinchGesture::cancelled);
QVERIFY(cancelledSpy.isValid());
QSignalSpy progressSpy(&gesture, &PinchGesture::progress);
QVERIFY(progressSpy.isValid());
recognizer.startPinchGesture(4);
QCOMPARE(startedSpy.count(), 1);
QCOMPARE(triggeredSpy.count(), 0);
QCOMPARE(cancelledSpy.count(), 0);
QCOMPARE(progressSpy.count(), 0);
}
void GestureTest::testUnregisterSwipeCancels()
{
GestureRecognizer recognizer;
......@@ -251,20 +484,19 @@ void GestureTest::testDeleteSwipeCancels()
void GestureTest::testSwipeCancel_data()
{
QTest::addColumn<GestureDirection>("direction");
QTest::addColumn<KWin::SwipeGesture::Direction>("direction");
QTest::newRow("Up") << GestureDirection::Up;
QTest::newRow("Left") << GestureDirection::Left;
QTest::newRow("Right") << GestureDirection::Right;
QTest::newRow("Down") << GestureDirection::Down;
QTest::newRow("Up") << KWin::SwipeGesture::Direction::Up;
QTest::newRow("Left") << KWin::SwipeGesture::Direction::Left;
QTest::newRow("Right") << KWin::SwipeGesture::Direction::Right;
QTest::newRow("Down") << KWin::SwipeGesture::Direction::Down;
}
void GestureTest::testSwipeCancel()
{
GestureRecognizer recognizer;
std::unique_ptr<SwipeGesture> gesture(new SwipeGesture);
QFETCH(GestureDirection, direction);
QFETCH(SwipeGesture::Direction, direction);
gesture->setDirection(direction);
QSignalSpy startedSpy(gesture.get(), &SwipeGesture::started);
QVERIFY(startedSpy.isValid());
......@@ -284,20 +516,20 @@ void GestureTest::testSwipeCancel()
void GestureTest::testSwipeUpdateTrigger_data()
{
QTest::addColumn<GestureDirection>("direction");
QTest::addColumn<KWin::SwipeGesture::Direction>("direction");
QTest::addColumn<QSizeF>("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") << KWin::SwipeGesture::Direction::Up << QSizeF(2, -3);
QTest::newRow("Left") << KWin::SwipeGesture::Direction::Left << QSizeF(-3, 1);
QTest::newRow("Right") << KWin::SwipeGesture::Direction::Right << QSizeF(20, -19);
QTest::newRow("Down") << KWin::SwipeGesture::Direction::Down << QSizeF(0, 50);
}
void GestureTest::testSwipeUpdateTrigger()
{
GestureRecognizer recognizer;
SwipeGesture gesture;
QFETCH(GestureDirection, direction);
QFETCH(SwipeGesture::Direction, direction);
gesture.setDirection(direction);
QSignalSpy triggeredSpy(&gesture, &SwipeGesture::triggered);
......@@ -318,22 +550,50 @@ void GestureTest::testSwipeUpdateTrigger()
QCOMPARE(triggeredSpy.count(), 1);
}
void GestureTest::testSwipeFingerCount_data()
void GestureTest::testSwipeMinFingerStart_data()
{
QTest::addColumn<uint>("min");
QTest::addColumn<uint>("count");
QTest::addColumn<bool>("started");
QTest::newRow("same") << 1u << 1u << true;
QTest::newRow("less") << 2u << 1u << false;
QTest::newRow("more") << 1u << 2u << true;
}
void GestureTest::testSwipeMinFingerStart()
{
QTest::addColumn<uint>("expected");
GestureRecognizer recognizer;
SwipeGesture gesture;
QFETCH(uint, min);
gesture.setMinimumFingerCount(min);
QSignalSpy startedSpy(&gesture, &SwipeGesture::started);
QVERIFY(startedSpy.isValid());
recognizer.registerSwipeGesture(&gesture);
QFETCH(uint, count);
recognizer.startSwipeGesture(count);
QTEST(!startedSpy.isEmpty(), "started");
}
void GestureTest::testSwipeMaxFingerStart_data()
{
QTest::addColumn<uint>("max");
QTest::addColumn<uint>("count");
QTest::addColumn<bool>("started"); // Should it accept
QTest::addColumn<bool>("started");
QTest::newRow("acceptable") << 1u << 1u << true;
QTest::newRow("unacceptable") << 2u << 1u << false;
QTest::newRow("same") << 1u << 1u << true;
QTest::newRow("less") << 2u << 1u << true;
QTest::newRow("more") << 1u << 2u << false;
}
void GestureTest::testSwipeFingerCount()
void GestureTest::testSwipeMaxFingerStart()
{
GestureRecognizer recognizer;
SwipeGesture gesture;
QFETCH(uint, expected);
gesture.addFingerCount(expected);
QFETCH(uint, max);
gesture.setMaximumFingerCount(max);
QSignalSpy startedSpy(&gesture, &SwipeGesture::started);
QVERIFY(startedSpy.isValid());
......@@ -352,11 +612,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(SwipeGesture::Direction::Up);
down.setDirection(SwipeGesture::Direction::Down);
right.setDirection(SwipeGesture::Direction::Right);
expand.setDirection(PinchGesture::Direction::Expanding);
contract.setDirection(PinchGesture::Direction::Contracting);
recognizer.registerSwipeGesture(&up);
recognizer.registerSwipeGesture(&down);
recognizer.registerSwipeGesture(&right);
......
......@@ -32,9 +32,21 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi
Q_UNUSED(action)
}
void InputRedirection::registerGesture(GestureDeviceType, GestureDirection, uint, QAction *, std::function<void(qreal)>)
void InputRedirection::registerTouchpadSwipeShortcut(SwipeDirection, uint fingerCount, QAction *)
{
Q_UNUSED(fingerCount)
}
void InputRedirection::registerRealtimeTouchpadSwipeShortcut(SwipeDirection, uint fingerCount, QAction *, std::function<void(qreal)> progressCallback)
{
Q_UNUSED(progressCallback)
Q_UNUSED(fingerCount)
}
void InputRedirection::registerTouchscreenSwipeShortcut(SwipeDirection, uint, QAction *, std::function<void(qreal)>)
{
}
}
Q_DECLARE_METATYPE(Qt::Orientation)
......
......@@ -816,9 +816,29 @@ 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<void(qreal)> progressCallback)
void EffectsHandlerImpl::registerRealtimeTouchpadSwipeShortcut(SwipeDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
{
input()->registerGesture(device, direction, fingerCount, onUp, progressCallback);
input()->registerRealtimeTouchpadSwipeShortcut(dir, fingerCount, onUp, progressCallback);
}
void EffectsHandlerImpl::registerTouchpadSwipeShortcut(SwipeDirection direction, uint fingerCount, QAction *action)
{
input()->registerTouchpadSwipeShortcut(direction, fingerCount, action);
}
void EffectsHandlerImpl::registerRealtimeTouchpadPinchShortcut(PinchDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
{
input()->registerRealtimeTouchpadPinchShortcut(dir, fingerCount, onUp, progressCallback);
}
void EffectsHandlerImpl::registerTouchpadPinchShortcut(PinchDirection direction, uint fingerCount, QAction *action)
{
input()->registerTouchpadPinchShortcut(direction, fingerCount, action);
}
void EffectsHandlerImpl::registerTouchscreenSwipeShortcut(SwipeDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback)
{
input()->registerTouchscreenSwipeShortcut(direction, fingerCount, action, progressCallback);
}
void *EffectsHandlerImpl::getProxy(QString name)
......
......@@ -104,8 +104,11 @@ 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<void(qreal)> progressCallback) override;
void registerRealtimeTouchpadSwipeShortcut(SwipeDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback) override;
void registerTouchpadSwipeShortcut(SwipeDirection direction, uint fingerCount, QAction *action) override;
void registerRealtimeTouchpadPinchShortcut(PinchDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback) override;
void registerTouchpadPinchShortcut(PinchDirection direction, uint fingerCount, QAction *action) override;
void registerTouchscreenSwipeShortcut(SwipeDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback) override;
void *getProxy(QString name) override;
void startMousePolling() override;
void stopMousePolling() override;
......
......@@ -61,7 +61,7 @@ DesktopGridEffect::DesktopGridEffect()
}
});
effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Up, 4, m_realtimeToggleAction, [this](qreal progress) {
effects->registerRealtimeTouchpadSwipeShortcut(SwipeDirection::Up, 4, m_realtimeToggleAction, [this](qreal progress) {
if (!effects->hasActiveFullScreenEffect() || effects->activeFullScreenEffect() == this) {
switch (m_status) {
case Status::Inactive:
......
......@@ -66,8 +66,8 @@ OverviewEffect::OverviewEffect()
}
};
effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Contracting, 4, m_realtimeToggleAction, progressCallback);
effects->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Up, 3, m_realtimeToggleAction, progressCallback);
effects->registerRealtimeTouchpadPinchShortcut(PinchDirection::Contracting, 4, m_realtimeToggleAction, progressCallback);
effects->registerTouchscreenSwipeShortcut(SwipeDirection::Up, 3, m_realtimeToggleAction, progressCallback);
connect(effects, &EffectsHandler::screenAboutToLock, this, &OverviewEffect::realDeactivate);
......
......@@ -125,8 +125,8 @@ WindowViewEffect::WindowViewEffect()
}
}
};
effects->registerGesture(GestureDeviceType::Touchpad, GestureDirection::Down, 4, m_realtimeToggleAction, gestureCallback);
effects->registerGesture(GestureDeviceType::Touchscreen, GestureDirection::Down, 3, m_realtimeToggleAction, gestureCallback);
effects->registerRealtimeTouchpadSwipeShortcut(SwipeDirection::Down, 4, m_realtimeToggleAction, gestureCallback);