Testing goodies.
This commit is contained in:
commit
a3308aa9fd
43 files changed
+4008
-54
No files matched your search
@@ -0,0 +1,263 @@
|
||||
# Touch Screen Support
|
||||
|
||||
Goal: a blind user can run the whole Linux desktop with the touch screen as the
|
||||
only input, the way TalkBack, VoiceOver and NVDA touch work. Touch is its own
|
||||
subsystem with its own gestures, bindings and modes. It shares only the
|
||||
"what is at this point" hit test with mouse review.
|
||||
|
||||
Integrated into `testing` from Chase Cichorz's three-commit touch patch.
|
||||
|
||||
## Design
|
||||
|
||||
- `internal/platform/evdev`: reads the touch screen directly from the Linux
|
||||
input layer, pure Go with no cgo. It finds direct multitouch devices
|
||||
(`INPUT_PROP_DIRECT` with `ABS_MT_SLOT`, positions and tracking IDs), grabs
|
||||
the device with `EVIOCGRAB` while touch is on, and turns multitouch
|
||||
protocol B frames into begin, update and end contacts in screen pixels. While
|
||||
grabbed, the X server and every other program get no touches; releasing the
|
||||
grab gives them back. Requires read access to `/dev/input`: the user must be
|
||||
in the `input` group (or an equivalent udev rule), as Fenrir already needs.
|
||||
Cthulhu speaks a message once if access is denied.
|
||||
- `internal/platform/xorg/touch.go`, `touch_native.c`, `touch_native.h`: the
|
||||
only X11 parts. A `WindowLocator` on its own X connection finds the client
|
||||
PID under a point (`_NET_WM_PID`, then XRes) and clicks with XTest for
|
||||
activation. No XInput2 touch grab is used.
|
||||
- `internal/touch`: pure Go gesture recognizer, no native code. Callers feed
|
||||
timestamped contacts and call `Tick`. Recognizes 1 to 4 finger tap, double
|
||||
tap, triple tap, hold, flicks in four directions, double tap and hold, two
|
||||
finger rotation, and up to ten fingers. One finger held past 200 ms explores
|
||||
instead of gesturing, so quick flicks never speak. Taps wait 350 ms for more
|
||||
taps. Contact state is bounded at 64 and lifted slots are reused, so finger
|
||||
bounces can never lose a lift.
|
||||
- `internal/app/touch.go`: lifecycle service. Grabs only while
|
||||
`Reading.EnableTouchScreen` is on and the focus gate is not locked. Hit tests
|
||||
run in a separate worker that keeps only the latest point.
|
||||
- Setting: `enable-touch-screen` in `[profiles.<name>.presentation.reading]`,
|
||||
default off. Preferences checkbox "Use the touch screen with gestures" and
|
||||
quick toggle "Touch screen".
|
||||
- Keyboard: `toggle-touch-screen`, Cthulhu+Ctrl+Alt+T (as NVDA+Ctrl+Alt+T),
|
||||
flips the quick toggle for the session and says "Touch screen on" or "off".
|
||||
Saving speech settings keeps it.
|
||||
|
||||
## Current gestures
|
||||
|
||||
Gestures map to Cthulhu's keyboard commands, so touch and keyboard users
|
||||
reach the same features. The mapping lives in `internal/app/touch_navigation.go`
|
||||
as one table per mode, and every row below is tested in
|
||||
`touch_navigation_test.go`. Rules from testers: within a mode every gesture
|
||||
does one thing; shared gestures mean the same in every mode; every mode has
|
||||
its own rotor and no two modes share a rotor list. Each mode remembers its
|
||||
own rotor position.
|
||||
|
||||
Shared by every mode:
|
||||
|
||||
- One finger rest or drag: speak what is under the finger (line of text over
|
||||
unnamed containers). Lifting moves object review there. Empty space says
|
||||
"Blank" once until the finger reaches something; testers found silence
|
||||
sounded broken. Crossing into another window, or off every window, says
|
||||
that window's title (or "Desktop") first, once per crossing.
|
||||
- One finger tap: speak it again. Double tap: activate what was last moved
|
||||
(click an explored point, `object-activate` after an object move or Tab,
|
||||
`document-activate` after a browse move). In speech settings mode, double
|
||||
tap saves.
|
||||
- Double tap and hold: right click an explored point, or press the context
|
||||
menu key after an object move.
|
||||
- Two finger tap: stop speech. Two finger triple tap: Escape. Two finger
|
||||
rotate: the current mode's rotor.
|
||||
- Three finger tap: next mode. Three finger flick right and left: Tab and
|
||||
Shift+Tab. Down: `read-all`. Up: `present-window-title`.
|
||||
- Four finger tap: `present-last-notification`. Double tap:
|
||||
`show-notification-list`.
|
||||
|
||||
Modes, in three finger tap order:
|
||||
|
||||
- Navigation mode (default, like TalkBack): flick right and left
|
||||
`object-next-item` and `object-previous-item`. Rotor chooses flick down and
|
||||
up: Scroll (mouse wheel at the last touch), Windows and Workspaces (i3), or
|
||||
Notifications (next and previous).
|
||||
- Text mode: rotor chooses Lines, Words or Characters. Flick right and left
|
||||
move by the unit, down reads the current one, up spells it (phonetic for
|
||||
characters). Flat review commands.
|
||||
- Browse mode: flick right and left move the browse cursor by line in page
|
||||
order, like the Down and Up arrows. Rotor chooses headings, links,
|
||||
buttons, form fields, landmarks, tables, lists, list items, paragraphs,
|
||||
images, check boxes, combo boxes, radio buttons or clickables; flick down
|
||||
and up move by it. Entered by itself on a
|
||||
web page and left again with it, unless chosen by hand.
|
||||
- Object mode: flick right and left siblings, up parent, down first child.
|
||||
No rotor.
|
||||
- Speech settings mode: flick right and left choose a setting, up and down
|
||||
change it; the rotor changes category.
|
||||
|
||||
Touch commands enter the keyboard command dispatch through
|
||||
`commandRuntime.touchCommands`, so gestures behave exactly like the bound
|
||||
keys. The three new commands have no default keys yet.
|
||||
|
||||
Hit testing (`internal/atspi/mouse_review_native.go`, shared with mouse
|
||||
review) now scans the children of the object where the provider's own hit
|
||||
test stopped. Chromium stopped at tables, so cells were never reached.
|
||||
|
||||
## Roadmap
|
||||
|
||||
1. Done: direct touch screen input, recognizer, explore by touch, activate, stop speech.
|
||||
2. Done: item navigation, rotor, web mode, Tab, Shift+Tab and Escape.
|
||||
Still to add: Enter outside web mode.
|
||||
3. Rotor done. Later: continuous rotation while turning, and per mode lists.
|
||||
4. Desktop gestures through i3: switch windows and workspaces, launcher,
|
||||
notifications.
|
||||
5. Touch typing: an on-screen keyboard explored by finger, lift to type.
|
||||
Braille screen input later.
|
||||
6. Pass-through mode and double tap and hold pass-through for sliders and
|
||||
drags; gesture remapping in preferences.
|
||||
|
||||
## Open issues
|
||||
|
||||
- Lock screen: Stormux enables I38lock by default on new installs. Touch is
|
||||
turned off while the focus gate is locked, so a touch-only user cannot
|
||||
unlock. Needs touch on the lock screen plus touch typing for the password.
|
||||
- Activation clicks at the explored point. AT-SPI actions may be better for
|
||||
some widgets.
|
||||
- Only X11 is supported. Wayland needs a compositor protocol and is deferred.
|
||||
- Coordinates map the whole touch range onto the X screen. Rotation (tablet
|
||||
mode) and multiple monitors are not handled yet.
|
||||
- Pass-through could use uinput to replay touches to the desktop as a virtual
|
||||
touch screen. Not built yet.
|
||||
- Packaging must tell users to join the `input` group.
|
||||
- App survey on the test laptop (32 point hit test grid per window):
|
||||
Shelly (Avalonia) exposes nothing; Mousepad reports one text object with no
|
||||
text at the point; PCManFM list view and Thunar list view find file names;
|
||||
GTK dialogs (Thunar preferences, Mumble wizard, preferred applications)
|
||||
find labels, check boxes and combo boxes; qv4l2, qvidcap and tkremind opened
|
||||
no window in time.
|
||||
- Thunar's icon view exposes one empty panel and no items, so files cannot
|
||||
be explored by touch there. Thunar's detailed list view exposes table rows
|
||||
and cells. Hit testing now also searches up to three levels below where the
|
||||
provider stops (GTK notebooks report page tabs as only their label).
|
||||
- Tests in `internal/app` read the real session bus. When I38lock is active
|
||||
they fail on an unchanged tree too. Run them under `dbus-run-session --`.
|
||||
|
||||
## Testing
|
||||
|
||||
- Automated: `python3 tests/native_test_session.py go test ./internal/touch ./internal/platform/evdev ./internal/i3command ./internal/review ./internal/app ./internal/config ./internal/preferences ./internal/platform/xorg -count=1`.
|
||||
`internal/app` tests read the real session bus, so run them under
|
||||
`dbus-run-session` or they fail while a screen lock is active.
|
||||
- Native X11: `python3 tests/native_test_session.py env CTHULHU_NATIVE_X11=1 go test ./internal/platform/xorg -run "TestNativeWindowLocator|TestNativeTouchKey" -count=1`
|
||||
(needs xterm, xdotool and xprop). Real touch device discovery:
|
||||
`CTHULHU_NATIVE_EVDEV=1 go test ./internal/platform/evdev -run TestNativeFindTouchScreens`.
|
||||
- Live: run `build/cthulhu --replace --config <copy of your settings> --debug-file <log>`
|
||||
with `enable-touch-screen = true` in the copy, and keep a way back to the
|
||||
installed reader. Use a separate settings file: the testing branch writes
|
||||
settings schema 3, which master refuses to load. Touch gestures are logged
|
||||
at debug level as `touch gesture`; silent explore points as
|
||||
`touch review silent` with a reason.
|
||||
- Testers used local helper scripts (switching between the test and
|
||||
installed builds, a spoken gesture trainer, an app hit test survey). They
|
||||
are not part of this repository.
|
||||
- Test hardware: Lenovo Yoga 7 2-in-1 14AKP10, touch screen
|
||||
"Wacom HID 53FC Finger", 10 touch points, 1920x1200, Stormux on XLibre
|
||||
with i3, MATE and SonicDE.
|
||||
|
||||
## Log
|
||||
|
||||
- 2026-11-24: Spoken trainer passed all 29 gestures on the Yoga, including ten
|
||||
fingers at once. Recognizer, X11 grab, explore by touch, double tap
|
||||
activation and two finger stop speech added. Automated tests pass. Live
|
||||
testing started with `cthulhu-switch test`.
|
||||
- 2026-11-24: First live test in Brave. Explore by touch worked but was chatty
|
||||
about unnamed containers and repeated link text. About a minute in, AT-SPI
|
||||
speech stopped and the touch service later hung on shutdown; a reboot was
|
||||
needed. The X server touch class on the core pointer had grown from 10 to 41,
|
||||
so sequences may have leaked. Changes: touch accepts are flushed at once,
|
||||
window lookups moved off the touch loop to the reviewer's own X connection,
|
||||
explore hit tests limited to one per 40 ms and 3 px, mouse review stays quiet
|
||||
for one second after touch input, unnamed containers and repeated names are
|
||||
skipped. `cthulhu-switch` now records native and Go stacks of a test build
|
||||
that does not hand over, and runs `touchcount` to log touch class sizes.
|
||||
- 2026-11-24: Root cause of the freeze found with gdb: the window lookup held
|
||||
the X11 guard and then called the XRes helpers, which take the same
|
||||
non-recursive guard. The lookup deadlocked and every other X11 reader blocked
|
||||
behind it, so AT-SPI speech stopped. It happened when the point had no
|
||||
`_NET_WM_PID`, for example the screen edge. Fixed by running the XRes fallback
|
||||
after releasing the guard and checking XRes support once per connection.
|
||||
`TestNativeWindowLocatorFallbackReleasesGuard` reproduces it with an xterm
|
||||
whose `_NET_WM_PID` is removed: it fails on the old code and passes now.
|
||||
- 2026-11-24: Switched touch input from the XInput2 grab to evdev with
|
||||
`EVIOCGRAB`, at the tester's request, so touch no longer depends on X11
|
||||
input handling. The test user was added to the `input` group. Tracker tests
|
||||
cover one and two fingers, slot reuse, one-frame touches and `SYN_DROPPED`.
|
||||
- 2026-11-24: Live test of direct input passed: explore, tap, double tap and
|
||||
two finger stop speech work in Brave. Added item navigation (flick right
|
||||
and left), explore committing to object review, and `object-activate` with
|
||||
a preferred default action (click, press, activate, jump, open, toggle,
|
||||
select). Item walk tests cover reading order, skipped containers, window
|
||||
edges and `Cursor.Set`.
|
||||
- 2026-11-24: Live test passed: flick right and left item navigation and double
|
||||
tap activation after a flick work in Brave.
|
||||
- 2026-11-24: Explore in Brave said only "Files, table" over a file list:
|
||||
Chromium's hit test stopped at the table. Added the child scan fallback to
|
||||
the shared hit test and line reading over unnamed containers. Added the
|
||||
rotor, web mode, three finger mode switch, three finger Tab, and two finger
|
||||
triple tap Escape. The native mouse review test still passes.
|
||||
- 2026-11-24: Rotor works live. Tester feedback: web mode duplicated flicks
|
||||
and rotor units. Removed modes; flicks are always items, the rotor picks
|
||||
browse or flat review commands automatically, and the three finger tap is
|
||||
free.
|
||||
- 2026-11-24: Desktop mode (arrow key flicks) was hard to discover and was
|
||||
dropped. Rebuilt the mapping on Cthulhu's keyboard commands and NVDA's touch
|
||||
modes: object, text, speech settings and automatic browse mode; four finger
|
||||
flicks for windows and workspaces; four finger taps for notifications.
|
||||
- 2026-11-24: Switched the tester's Thunar to the detailed list view; a hit
|
||||
test probe now finds file names (git, Projects, Videos). Browse mode can be
|
||||
chosen by hand in any app.
|
||||
- 2026-11-24: Added `toggle-touch-screen` (Cthulhu+Ctrl+Alt+T) and surveyed
|
||||
twelve installed apps.
|
||||
- 2026-11-24: Tester found object mode odd as a default and text mode weird.
|
||||
Navigation mode is now the default; every mode has its own rotor, as one
|
||||
table per mode; scrolling added. Four finger flicks were moved into the
|
||||
navigation rotor so windows and workspaces live in one place.
|
||||
- 2026-11-24: Settings saved in the test build were lost on restart because
|
||||
`cthulhu-switch` copied the installed settings over them each time. The
|
||||
test settings file is now kept.
|
||||
- 2026-11-24: Browse mode flicks swapped at the tester's request: right and
|
||||
left read in page order, down and up follow the rotor.
|
||||
- 2026-11-24: MATE testing: the 24 pixel panels were too thin to find by
|
||||
touch (the tester's MATE panels were raised to 64). Explore now says
|
||||
"Blank" over empty space and names the window a finger crosses into.
|
||||
|
||||
## Integration review and acceptance
|
||||
|
||||
The integration fixes device retry starvation; uses scalar EVIOCGRAB arguments
|
||||
for acquisition and release; decodes native input-event sizes and byte order;
|
||||
rejects unsupported descriptors and slots; and cancels lost input instead of
|
||||
turning it into a tap. After overflow the service releases and reopens the
|
||||
device after five seconds to discard unknown slot state. Disable, lock and
|
||||
device loss clear the activation point and retire pending exploration results.
|
||||
Wayland sessions never grab a device. Synthesized keys preserve keys already
|
||||
held by the user. Item traversal has an explicit ascent limit. Empty i3 replies
|
||||
are failures and cancellation closes an outstanding command connection.
|
||||
|
||||
Before pushing, build from testing and check on the touchscreen:
|
||||
|
||||
1. Toggle with Cthulhu+Ctrl+Alt+T; explore, tap, double tap, rotate, and flick
|
||||
through each mode. Check speech and Braille, including window boundaries.
|
||||
2. Unplug/reconnect or enable before connecting the device. It should become
|
||||
available after the retry interval. Toggle off/on; a double tap must not
|
||||
activate an old point. Lock/unlock using the keyboard and repeat.
|
||||
3. Hold either physical Shift while issuing touch Shift+Tab. Shift must remain
|
||||
held until physically released; normal keyboard navigation must still work.
|
||||
4. Check mouse review, GTK notebook pages, browser tables, browse navigation,
|
||||
object navigation, and activation. Keep the reader responsive while moving
|
||||
a finger rapidly over a large page.
|
||||
5. Tab and Shift+Tab through the touch preferences checkbox, Apply, reopen,
|
||||
and restart using the saved test configuration to verify persistence.
|
||||
|
||||
Private automated tests do not establish physical touch, audible speech,
|
||||
Braille, or preferences keyboard acceptance. The original contributor's live
|
||||
results above are historical evidence, not verification of these review fixes.
|
||||
|
||||
Validation for this integration: the full Go suite passed in a private
|
||||
Xvfb/D-Bus session; focused touch/review/app race checks and focused go vet
|
||||
passed; native mouse hit testing, XRes window lookup, and held-key preservation
|
||||
passed. The reader, input helper, and BrlAPI-tagged Braille helper built.
|
||||
Translation catalog checks and git diff whitespace checks passed. No running
|
||||
reader was replaced and no physical touchscreen acceptance was performed.
|
||||
Reference in new issue
Block a user