diff options
| author | Nikolai Nechaev <nikolay_nechaev@mail.ru> | 2025-09-26 22:49:07 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-26 15:49:07 +0200 |
| commit | 4f3dd1ddb44c0798a7c1c9485b179b36304de098 (patch) | |
| tree | b401ab3e2f554adfd22b763bdf1660af9a7377d6 /src/config/ConfigManager.cpp | |
| parent | d8f615751acb0ae5ff8916c284c5636034a18b50 (diff) | |
config: fix gesture dispatcher parsing with whitespaces (#11784)
* config: fix gesture dispatcher parsing with whitespaces
Some dispatcher functions (e.g., `moveFocusTo`) expect the given string to be
stripped of whitepsaces.
This fixes `gesture` line parsing: rather than calling dispatcher functions
with the original string, we reuse words parsed by `CConstVarList` and join
them with a comma.
* tests/gestures: Add a test for `movecursortocorner`
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index cb82864f..70f0d2a3 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -3163,14 +3163,10 @@ std::optional<std::string> CConfigManager::handleGesture(const std::string& comm std::expected<void, std::string> result; - if (data[startDataIdx] == "dispatcher") { - auto dispatcherArgsIt = value.begin(); - for (int i = 0; i < startDataIdx + 2 && dispatcherArgsIt < value.end(); ++i) { - dispatcherArgsIt = std::find(dispatcherArgsIt, value.end(), ',') + 1; - } - result = g_pTrackpadGestures->addGesture(makeUnique<CDispatcherTrackpadGesture>(std::string{data[startDataIdx + 1]}, std::string(dispatcherArgsIt, value.end())), - fingerCount, direction, modMask, deltaScale); - } else if (data[startDataIdx] == "workspace") + if (data[startDataIdx] == "dispatcher") + result = g_pTrackpadGestures->addGesture(makeUnique<CDispatcherTrackpadGesture>(std::string{data[startDataIdx + 1]}, data.join(",", startDataIdx + 2)), fingerCount, + direction, modMask, deltaScale); + else if (data[startDataIdx] == "workspace") result = g_pTrackpadGestures->addGesture(makeUnique<CWorkspaceSwipeGesture>(), fingerCount, direction, modMask, deltaScale); else if (data[startDataIdx] == "resize") result = g_pTrackpadGestures->addGesture(makeUnique<CResizeTrackpadGesture>(), fingerCount, direction, modMask, deltaScale); |
