input-capture: coalescing looks back two entries
In remote mode one physical move queues a .mouse and an .edgeCandidate, so matching only the last entry meant the kinds alternated and motion was never coalesced -- the ring would fill at two entries per move whenever the Engine stalled, which is the case C3's coalescing exists to survive. The scan stops at the first non-motion entry so transitions keep order. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
fd1ceeac08
commit
84aa59a512
2 files changed
+50
-9
No files matched your search
@@ -43,9 +43,12 @@ code does not enforce is here.
|
||||
`swallowKeys`/`swallowMouse` are set by the Engine, not derived here.
|
||||
- **The queue is a bounded ring of 4096 `CapturedInput`s** in
|
||||
`MWBMac/CaptureQueue.swift` (it needs a lock, which `MWBCore` may not
|
||||
import). Motion is coalesced on push when the previous entry is also motion —
|
||||
latest position wins for an absolute move, deltas are **summed** for a
|
||||
relative one, and wheel deltas of the same axis are summed. A push that
|
||||
import). Motion is coalesced on push against either of the last two entries —
|
||||
two, because one physical move queues a `.mouse` *and* an `.edgeCandidate`
|
||||
while a peer is controlled — stopping at the first entry that is not motion,
|
||||
so a transition is never reordered past. Latest position wins for an absolute
|
||||
move, deltas are **summed** for a relative one, and wheel deltas of the same
|
||||
axis are summed. A push that
|
||||
cannot be satisfied routes control local and raises `.overflow`, which
|
||||
`drain()` reports even when the ring is full (contracts C3).
|
||||
- **Keyboard encoding**: `wVk` from `KeyMap.vk(forKeycode:)`; `dwFlags` =
|
||||
@@ -401,6 +404,13 @@ Decisions, in the order they were made:
|
||||
9. **A relative move is coalesced by summing.** The first version replaced the
|
||||
older entry, which is right for an absolute position and loses motion for a
|
||||
`MOVE_MOUSE_RELATIVE` delta. Fixed in the same lane.
|
||||
10. **Coalescing looks back two entries.** The first version matched only the
|
||||
last one, and in remote mode every physical move queues a `.mouse` followed
|
||||
by an `.edgeCandidate`, so the kinds alternate and nothing ever merged — the
|
||||
ring would have filled at two entries per move under a stalled Engine, which
|
||||
is precisely the case coalescing exists to survive. The scan stops at the
|
||||
first non-motion entry, so a button or key transition is never reordered
|
||||
past.
|
||||
|
||||
Deviations from the brief: the brief listed the device masks 0x01..0x40 and
|
||||
omitted `NX_DEVICERCTLKEYMASK 0x2000`, without which the right Control key
|
||||
|
||||
Reference in new issue
Block a user