Repository navigation
feat: map the pen buttons and the tablet keys - #175
Merged
Merged
Conversation
The pen button bindings were saved but never used. The engine now turns the buttons reported by the parsers into mouse buttons and keys, on Windows (SendInput, by scan code) and Linux (a virtual mouse and a new virtual keyboard). - core::input: the binding format (None, a mouse button, or a chord such as Ctrl+Shift+Z), with the OpenTabletDriver spellings still accepted. - tablet_manager::buttons: follows button changes only, counts shared keys, remembers the binding applied at press time and releases everything when the pen leaves, the tablet goes away or the engine stops. - aux_button_bindings: bindings for the keys on the tablet (ExpressKeys). - The tablet definition gives the pen button and tablet key counts, which reach the interface through get_tablet_status. - normalize_binding: lets the interface check a binding with the same parser.
Each pen button and tablet key gets a field with a list of presets, a recorder that captures a key or a shortcut, and the driver's own check of the text. A Tablet Keys section appears for tablets that have keys, and the rows follow the button counts of the tablet definition.
Pen buttons and tablet keys are no longer listed as not used. The guide covers the binding format, the recorder, how the buttons behave and the known limits.
Coverage
Coverage is well above its floor: raise The 10 least covered Rust files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The pen button bindings were saved but never used: the engine ignored them. This change makes the buttons work, and adds bindings for the keys on the tablet itself (ExpressKeys).
Left Click,Right Click,Middle Click,Back,Forward), a key, or a shortcut such asCtrl+Shift+Z.core::input(the binding format) andtablet_manager::buttons(follows button changes, counts shared keys, releases everything when the pen leaves, the tablet goes away or the engine stops). The binding is read when the button is pressed and kept until it is released, so editing a binding while a button is held cannot leave a key stuck.SendInput, keys sent as scan codes by position on a US keyboard, so the key recorded in the interface is the key that is pressed on any keyboard layout.NextTabletDriver Virtual Keyboard.aux_button_bindingssetting (old profiles load without it). The number of pen buttons and tablet keys comes from the tablet definition (Pen.ButtonCount,AuxiliaryButtons.ButtonCount), so each tablet shows the right rows.normalize_bindingcommand), a presets list, and a recorder for keys and shortcuts.Also changes
process_packetto take onePacketLoopStateinstead of two loop variables.How it was tested
cargo clippy --all-targets --all-features -- -D warningsclean on the root crate,sdkandsrc-tauri.cargo nextest run --all-features --profile ci: 602 passed. New tests cover the parser (aliases, errors, round trip), the router (order, shared modifiers, release on leave, release on stop, a binding edited while held), the Windows tables, and the tablet key counts.vitest263 passed,svelte-checkandeslintclean, Playwright 65 passed (new tests for tablet keys, recording and the error message). I looked at the screen in a browser with the dev mock.injector/linux.rs. I checked theevdevsignatures and key codes against the crate source.Known limits
Left Clickshares the left button with the tip; releasing one while the other is held also releases the click.mainfor dependencies that are not part of this change.Checklist
unwrap(),expect(),panic!or indexing on a runtime path, and I handled locks safely.docs/, or the interface) if a user or a developer can see the change.docs/releasing.md. (Does not apply.)