From 41dad381770300fe1015ad8cdd1f370a8fd4e5d5 Mon Sep 17 00:00:00 2001 From: Nikolai Nechaev Date: Sun, 21 Sep 2025 00:57:49 +0900 Subject: 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. --- src/config/ConfigManager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/config/ConfigManager.cpp') 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 CConfigManager::handleGesture(const std::string& comm std::expected result; - if (data[startDataIdx] == "dispatcher") - result = g_pTrackpadGestures->addGesture(makeUnique(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(std::string{data[startDataIdx + 1]}, std::string(dispatcherArgsIt, value.end())), + fingerCount, direction, modMask, deltaScale); + } else if (data[startDataIdx] == "workspace") result = g_pTrackpadGestures->addGesture(makeUnique(), fingerCount, direction, modMask, deltaScale); else if (data[startDataIdx] == "resize") result = g_pTrackpadGestures->addGesture(makeUnique(), fingerCount, direction, modMask, deltaScale); -- cgit v1.2.3