Fix pointer navigation in Quattro launcher menus (#6343)

Accumulate sub-threshold movement so slow motion with a flat acceleration profile updates selection. Sample pointer state on row entry and carry pointer intent through subordinate menus while preserving predictable keyboard selection.
This commit is contained in:
ssupt
2026-07-22 15:27:56 -07:00
committed by GitHub
parent 4a02da20d5
commit 3481b5614b
7 changed files with 184 additions and 17 deletions
+41 -2
View File
@@ -25,12 +25,51 @@ assert(
/function reset\(\)[\s\S]*root\.primed = false/.test(gateQml),
'pointer movement gate can be disarmed after keyboard or list changes'
)
assert(
/function reset\(\)[\s\S]*root\.initialSampleAllowed = false/.test(gateQml),
'reset keeps the initial pointer sample ignored by default'
)
assert(
/function allowInitialSample\(\)[\s\S]*root\.reset\(\)[\s\S]*root\.initialSampleAllowed = true/.test(gateQml),
'pointer-initiated transitions can opt in to the initial pointer sample'
)
assert(
/item\.mapToItem\(target, mouse\.x, mouse\.y\)/.test(gateQml),
'pointer movement gate compares movement in stable target coordinates'
)
assert(
/var didMove = root\.primed[\s\S]*Math\.abs\(point\.x - root\.lastX\) > root\.threshold[\s\S]*Math\.abs\(point\.y - root\.lastY\) > root\.threshold/.test(gateQml),
'pointer movement gate only reports real movement after an initial sample'
/var didMove = !firstSample[\s\S]*Math\.abs\(point\.x - root\.lastX\) > root\.threshold[\s\S]*Math\.abs\(point\.y - root\.lastY\) > root\.threshold[\s\S]*root\.initialSampleAllowed/.test(gateQml),
'pointer movement gate reports real movement or an explicitly allowed initial sample'
)
assert(
/if \(firstSample \|\| didMove\) \{\s*root\.lastX = point\.x\s*root\.lastY = point\.y\s*\}/.test(gateQml),
'sub-threshold pointer movement accumulates from the last accepted sample'
)
assert(
/root\.primed = true\s*root\.initialSampleAllowed = false/.test(gateQml),
'the initial pointer sample exception is consumed once'
)
JS
if ! command -v quickshell >/dev/null 2>&1; then
pass "quickshell not installed; skipping pointer movement gate runtime test"
exit 0
fi
test_tmp=$(mktemp -d)
trap 'rm -rf "$test_tmp"' EXIT
cp "$SHELL_TEST_DIR/fixtures/pointer-move-gate/shell.qml" "$test_tmp/shell.qml"
ln -s "$ROOT/shell/Ui" "$test_tmp/Ui"
output=$(timeout 15 quickshell -p "$test_tmp" --no-color 2>&1) || {
printf '%s\n' "$output" >&2
fail "pointer movement gate runtime fixture exits cleanly"
}
if ! grep -q "RESULT pass" <<<"$output"; then
printf '%s\n' "$output" >&2
fail "pointer movement gate runtime behavior is correct"
fi
pass "pointer movement gate runtime behavior is correct"