Rename GestureDirection to GestureType
This commit is contained in:
parent
6c0ed14800
commit
5de6c507db
18 changed files with 91 additions and 91 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -54,26 +54,26 @@ private Q_SLOTS:
|
|||
|
||||
void GestureTest::testDirection_data()
|
||||
{
|
||||
QTest::addColumn<GestureDirection>("direction");
|
||||
QTest::addColumn<GestureTypeFlag>("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<GestureDirection>("direction");
|
||||
QTest::addColumn<GestureTypeFlag>("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<SwipeGesture> 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<GestureDirection>("direction");
|
||||
QTest::addColumn<GestureTypeFlag>("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") << 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);
|
||||
|
|
|
@ -32,7 +32,7 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi
|
|||
Q_UNUSED(action)
|
||||
}
|
||||
|
||||
void InputRedirection::registerGesture(GestureDeviceType, GestureDirection, uint, QAction *, std::function<void(qreal)>)
|
||||
void InputRedirection::registerGesture(GestureDeviceType, GestureTypeFlag, 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, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
|
||||
void EffectsHandlerImpl::registerGesture(GestureDeviceType device, GestureTypeFlag 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, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback) override;
|
||||
void registerGesture(GestureDeviceType device, GestureTypeFlag 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, 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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<uint> 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;
|
||||
}
|
||||
|
|
|
@ -51,12 +51,12 @@ public:
|
|||
bool isFingerCountAcceptable(uint fingers) const;
|
||||
QSet<uint> 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<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, GestureDirections);
|
||||
void pixelDelta(const QSizeF &delta, GestureType);
|
||||
|
||||
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, GestureDirections direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback)
|
||||
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};
|
||||
|
@ -148,7 +148,7 @@ void GlobalShortcutsManager::registerGesture(GestureDeviceType device, GestureDi
|
|||
addIfNotExists(GlobalShortcut(std::move(shortcut), onUp), device);
|
||||
}
|
||||
|
||||
void GlobalShortcutsManager::forceRegisterTouchscreenSwipe(QAction *onUp, std::function<void(qreal)> progressCallback, GestureDirection direction, uint fingerCount)
|
||||
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);
|
||||
|
|
|
@ -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<void(qreal)> progressCallback = nullptr);
|
||||
void registerGesture(GestureDeviceType device, GestureType direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = nullptr);
|
||||
|
||||
void forceRegisterTouchscreenSwipe(QAction *action, std::function<void(qreal)> progressCallback, GestureDirection direction, uint fingerCount);
|
||||
void forceRegisterTouchscreenSwipe(QAction *action, std::function<void(qreal)> 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> swipeGesture;
|
||||
|
|
|
@ -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<void(qreal)> progressCallback)
|
||||
void InputRedirection::registerGesture(GestureDeviceType device, GestureTypeFlag 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(GestureDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback)
|
||||
void InputRedirection::forceRegisterTouchscreenSwipeShortcut(GestureTypeFlag 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, 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 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 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, GestureDirection direction, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = nullptr) = 0;
|
||||
virtual void registerGesture(GestureDeviceType device, GestureTypeFlag 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 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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue