Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ The defaults may not work for everyone, as they depend on the device's sensitivi
## Gesture
See [example_gestures.md](example_gestures.md) for examples.

| Property | Type | Description | Default |
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| **type** | ``enum(hold, pinch, rotate, swipe)`` | For *pinch in* gestures, the scale ranges from 1.0 to 0.0. For *pinch out*, the scale is larger than 1.0. | *none* |
| **direction** | Pinch: ``enum(in, out, any)``<br>Rotate: ``enum(any, clockwise, counterclockwise)``<br>Swipe: ``enum(left, right, up, down, left_right, up_down, any)`` | *any*, *left_right* and *up_down* are bi-directional gestures. The direction can be changed during the gesture. | *none* |
| **fingers** | ``uint`` (exact amount) or ``range(uint)`` | The exact amount or range of fingers required to trigger this gesture.<br><br>Minimum value: *1* for *hold* gestures, *2* for *pinch* and *swipe* gestures.<br>Maximum value: Depends on how many fingers the device can detect.<br><br>2-finger swipe gestures override scrolling and end automatically after 100 ms of inactivity. | *none* |
| speed | ``enum(any, fast, slow)`` | The speed at which the gesture must be performed.<br><br>If a value other than *any* is specified, this gesture will cause all other gestures of the same device and type to be delayed by *Speed.events* input events until the speed is determined. | *any* |
| threshold | ``float`` (min) or ``range(float)`` (min and max) | How far this gesture needs to progress in order to be activated.<br><br>A gesture with *begin* or *update* actions can't have a maximum threshold. | *none* |
| modifiers | ``flags(alt, ctrl, meta, shift)``, ``any`` or ``none`` | *any* - Modifiers are ignored<br>*none* - No modifier keys must be pressed<br><br>Keyboard modifiers that must be pressed in order for the gesture to be activated. Only checked on gesture begin.<br><br>All pressed modifier keys will be released when the gesture begins in order to prevent conflicts with input actions. | *any* |
| conditions | ``list(Condition)`` | See <a href="#condition">*Condition*</a> below.<br><br>At least one condition (or 0 if none specified) must be satisfied in order for this gesture to be triggered. | *none* |
| actions | ``list(Action)`` | See <a href="#action">*Action*</a> below. | *none* |
| Property | Type | Description | Default |
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| **type** | ``enum(hold, pinch, rotate, swipe)`` | For *pinch in* gestures, the scale ranges from 1.0 to 0.0. For *pinch out*, the scale is larger than 1.0. | *none* |
| **direction** | Pinch: ``enum(in, out, any)``<br>Rotate: ``enum(any, clockwise, counterclockwise)``<br>Swipe: ``enum(left, right, up, down, left_right, up_down, any)`` | *any*, *left_right* and *up_down* are bi-directional gestures. The direction can be changed during the gesture. | *none* |
| **fingers** | ``uint`` (exact amount) or ``range(uint)`` | The exact amount or range of fingers required to trigger this gesture.<br><br>Minimum value: *1* for *hold* gestures, *2* for *pinch* and *swipe* gestures.<br>Maximum value: Depends on how many fingers the device can detect.<br><br>2-finger swipe gestures override scrolling and end automatically after 100 ms of inactivity. | *none* |
| speed | ``enum(any, fast, slow)`` | The speed at which the gesture must be performed.<br><br>If a value other than *any* is specified, this gesture will cause all other gestures of the same device and type to be delayed by *Speed.events* input events until the speed is determined. | *any* |
| threshold | ``float`` (min) or ``range(float)`` (min and max) | How far this gesture needs to progress in order to be activated.<br><br>A gesture with *begin* or *update* actions can't have a maximum threshold. | *none* |
| keyboard_modifiers | ``flags(alt, ctrl, meta, shift)``, ``any`` or ``none`` | *any* - Modifiers are ignored<br>*none* - No modifier keys must be pressed<br><br>Keyboard modifiers that must be pressed in order for the gesture to be activated. Only checked on gesture begin.<br><br>All pressed modifier keys will be released when the gesture begins in order to prevent conflicts with input actions. | *any* |
| conditions | ``list(Condition)`` | See <a href="#condition">*Condition*</a> below.<br><br>At least one condition (or 0 if none specified) must be satisfied in order for this gesture to be triggered. | *none* |
| actions | ``list(Action)`` | See <a href="#action">*Action*</a> below. | *none* |

## Condition
All specified subconditions must be satisfied in order for the condition to be satisfied. OR conditions can be created by adding multiple conditions.
Expand Down
2 changes: 1 addition & 1 deletion src/libgestures/libgestures/gestures/gesture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const GestureSpeed &Gesture::speed() const
return m_speed;
}

const std::optional<Qt::KeyboardModifiers> &Gesture::modifiers() const
const std::optional<Qt::KeyboardModifiers> &Gesture::keyboardModifiers() const
{
return m_modifiers;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libgestures/libgestures/gestures/gesture.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Gesture : public QObject
bool satisfiesBeginConditions(const uint8_t &fingerCount) const;

const GestureSpeed &speed() const;
const std::optional<Qt::KeyboardModifiers> &modifiers() const;
const std::optional<Qt::KeyboardModifiers> &keyboardModifiers() const;

void addAction(const std::shared_ptr<GestureAction> &action);
void addCondition(const std::shared_ptr<const Condition> &condition);
Expand Down
2 changes: 1 addition & 1 deletion src/libgestures/libgestures/gestures/gesturerecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void GestureRecognizer::gestureBegin(const uint8_t &fingerCount, std::vector<std
m_isDeterminingSpeed = true;
}

if (castedGesture->modifiers() && *castedGesture->modifiers() != Qt::KeyboardModifier::NoModifier) {
if (castedGesture->keyboardModifiers() && *castedGesture->keyboardModifiers() != Qt::KeyboardModifier::NoModifier) {
hasModifiers = true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/libgestures/libgestures/yaml_convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ struct convert<std::shared_ptr<libgestures::Gesture>>
gesture->setSpeed(node["speed"].as<libgestures::GestureSpeed>(libgestures::GestureSpeed::Any));
gesture->setThresholds(threshold.min, threshold.max);

if (const auto modifiersNode = node["modifiers"]) {
if (const auto modifiersNode = node["keyboard_modifiers"]) {
if (modifiersNode.IsSequence()) {
if (const auto modifiers = modifiersNode.as<Qt::KeyboardModifiers>(Qt::KeyboardModifier::NoModifier)) {
gesture->setKeyboardModifiers(modifiers);
Expand All @@ -678,7 +678,7 @@ struct convert<std::shared_ptr<libgestures::Gesture>>
} else if (modifierMatchingMode == "none") {
gesture->setKeyboardModifiers(Qt::KeyboardModifier::NoModifier);
} else {
throw Exception(node.Mark(), "Invalid modifiers");
throw Exception(node.Mark(), "Invalid keyboard modifier");
}
}
}
Expand Down