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.
This commit is contained in:
Nikolai Nechaev 2025-09-21 00:57:49 +09:00 committed by GitHub
parent 838439080a
commit 41dad38177
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 25 deletions

View file

@ -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);