Refactor DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer

This constant is not DEFAULT_UNIT_SCALE_DELTA.
This makes more sense now that we're using realtime gestures.
This commit is contained in:
Eric Edlund 2022-03-19 10:06:01 -04:00
parent 5d9e0be959
commit a508a8c6db
2 changed files with 8 additions and 3 deletions

View file

@ -316,7 +316,7 @@ void GestureTest::testSetMinimumDelta()
PinchGesture pinchGesture;
QCOMPARE(pinchGesture.isMinimumScaleDeltaRelevant(), false);
QCOMPARE(pinchGesture.minimumScaleDelta(), DEFAULT_MINIMUM_SCALE_DELTA);
QCOMPARE(pinchGesture.minimumScaleDelta(), DEFAULT_UNIT_SCALE_DELTA);
QCOMPARE(pinchGesture.minimumScaleDeltaReached(1.25), true);
pinchGesture.setMinimumScaleDelta(.5);
QCOMPARE(pinchGesture.isMinimumScaleDeltaRelevant(), true);

View file

@ -19,7 +19,12 @@
namespace KWin
{
static const qreal DEFAULT_MINIMUM_SCALE_DELTA = .2; // 20%
/*
* Everytime the scale of the gesture changes by this much, the callback changes by 1.
* This is the amount of change for 1 unit of change, like switch by 1 desktop.
* */
static const qreal DEFAULT_UNIT_SCALE_DELTA = .2; // 20%
class Gesture : public QObject
{
Q_OBJECT
@ -166,7 +171,7 @@ private:
uint m_maximumFingerCount = 0;
Direction m_direction = Direction::Expanding;
bool m_minimumScaleDeltaRelevant = false;
qreal m_minimumScaleDelta = DEFAULT_MINIMUM_SCALE_DELTA;
qreal m_minimumScaleDelta = DEFAULT_UNIT_SCALE_DELTA;
};
class KWIN_EXPORT GestureRecognizer : public QObject