diff options
| author | Nikolai Nechaev <nikolay_nechaev@mail.ru> | 2025-09-21 00:57:49 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-20 17:57:49 +0200 |
| commit | 41dad381770300fe1015ad8cdd1f370a8fd4e5d5 (patch) | |
| tree | c59fd4c20e1879d0f8e6c4ee035fc387d64a0e25 /src/config/ConfigManager.cpp | |
| parent | 838439080a9feaac3386d694dc7f8463e41c51df (diff) | |
config: fix multi-argument gesture dispatcher parsing (#11721)
* config: Fix multi-argument gesture dispatchers parsing
The `dispatcher` gesture handler used to only handle
the first argument to the dispatcher, while some dispatchers
(e.g., `sendshortcut`) want multiple arguments.
This fixes `ConfigManager` to handle all the arguments
provided to the dispatcher gesture handler.
Fixes #11684.
* test/gestures: Add a test for a gesture with a multi-argument dispatcher
* test/gestures: Factor out `waitForWindowCount`
Reduce code duplication in the gestures test.
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index db0dd596..78ca1fe1 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -3229,10 +3229,14 @@ std::optional<std::string> CConfigManager::handleGesture(const std::string& comm std::expected<void, std::string> result; - if (data[startDataIdx] == "dispatcher") - result = g_pTrackpadGestures->addGesture(makeUnique<CDispatcherTrackpadGesture>(std::string{data[startDataIdx + 1]}, std::string{data[startDataIdx + 2]}), fingerCount, - direction, modMask, deltaScale); - else if (data[startDataIdx] == "workspace") + 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") 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); |
