Full remote input parity: forward mouse and structured key events over IPC

- New key_event/mouse_event client messages (crossterm serde) that run
  through the complete WM event handling on the server — remote clients
  get window focus, drag/resize and mouse forwarding into virtual
  terminals (SGR/UTF-8/X10) identical to standalone mode
- tui-wm -c now forwards mouse events; previously only keyboard worked
  remotely
- IPC unit tests + end-to-end integration test (tests/integration.py):
  daemon, frames, click/scroll SGR forwarding, popups, TUI-FM in a
  window — 12/12 passing
- Document the new messages in SOCKET_API.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 19:50:27 +02:00
parent 75aa7033a4
commit f0bed7a14e
8 changed files with 373 additions and 63 deletions

View File

@@ -85,6 +85,44 @@ Forward raw terminal input bytes to the focused window. Bytes are hex-encoded.
The example sends the bytes `0x1b 0x5b 0x41` (Up arrow).
### `key_event`
Forward a structured keyboard event. Unlike `input`, the event runs through
the full window-manager event handling: global keybinds, dialogs, focus and
PTY forwarding — exactly as if the key was pressed locally in standalone
mode. This is what `tui-wm -c` sends for every keypress.
```json
{
"type": "key_event",
"event": { "code": { "Char": "a" }, "modifiers": "CONTROL", "kind": "Press", "state": "" }
}
```
`code` is either `{ "Char": "<tecken>" }` or a string for special keys
(`"Enter"`, `"Esc"`, `"Tab"`, `"Backspace"`, `"Up"`, `"Down"`, `"Left"`,
`"Right"`, `"Home"`, `"End"`, `"PageUp"`, `"PageDown"`, `"Delete"`, ...).
`modifiers` is a `|`-separated string of `SHIFT`, `CONTROL`, `ALT`
(empty string = none).
### `mouse_event`
Forward a structured mouse event. Gives remote clients full mouse parity
with standalone mode: window focus, title-bar drag, resize, and forwarding
into the virtual terminals with correct SGR/UTF-8/X10 encoding and
coordinate translation. This is what `tui-wm -c` sends for every mouse event.
```json
{
"type": "mouse_event",
"event": { "kind": { "Down": "Left" }, "column": 10, "row": 5, "modifiers": "" }
}
```
`kind` is one of `{ "Down": <btn> }`, `{ "Up": <btn> }`, `{ "Drag": <btn> }`,
`"Moved"`, `"ScrollUp"`, `"ScrollDown"` where `<btn>` is `"Left"`,
`"Right"` or `"Middle"`. Coordinates are 0-based frame coordinates.
### `resize`
Notify the server that the display client's terminal has been resized.