Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/list-caps.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1072,9 +1072,9 @@ reason = SDL_WINDOW_FLAGS: application/dev tooling bound (scenario period, text
class = not-a-list
reason = SDL_WINDOW_INPUT_FOCUS: application/dev tooling bound (scenario period, text input buffer, capture or event header); not a list the user browses.

[src/app/run.rs::ingest_sdl_event_with_window]
[src/app/run.rs::log_raw_input_event]
class = not-a-list
reason = ingest_sdl_event_with_window: application/dev tooling bound (scenario period, text input buffer, capture or event header); not a list the user browses.
reason = log_raw_input_event: application/dev tooling bound (scenario period, text input buffer, capture or event header); not a list the user browses.

[src/capture.rs::caplisten]
class = not-a-list
Expand Down
18 changes: 9 additions & 9 deletions docs/remote-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ before `SDL_Init` (§5).
| `301` | `wcode` | `page_dir`, Library route only | CH▼ pages down (evdev 403 `KEY_CHANNELDOWN`) |
| `8` | `sym` | `screens::search::SearchScreen::step`, while editing | backspace |
| `156 \| 1<<30` | `sym` | `screens::search::SearchScreen::step`, while editing | the panel's **Clear all**. **Not producible from the evdev table** — it reaches us through the fork's own text/IME path, which is why it is measured but has no evdev provenance. |
| `48..=57` | `sym` | `screens::profiles`, PIN keypad | type that digit into the PIN. `screens::profiles::digit_of` also reads the range out of `wcode`, where it is **not** a digit — §9. |
| `48..=57` | `sym` | `screens::profiles`, PIN keypad | type that digit into the PIN. `consts::pin_digit` (moved from `screens::profiles::digit_of`) also reads the range out of `wcode`, where it is **not** a digit — §9. |

### Swallowed

Expand Down Expand Up @@ -201,10 +201,10 @@ change rather than a tidy-up, and the sibling codes (`402`, `415`, `413`) come f
`linux/input.h` does not name — so unlike `33`/`34` there is no positive evidence about them in
either direction. **Settle all four together, with the §7 capture plus a USB keyboard, in one pass.**

### 4.3 and 4.4 — `SDLK_SELECT`, and `digit_of`'s `wcode` arm
### 4.3 and 4.4 — `SDLK_SELECT`, and `pin_digit`'s `wcode` arm

The other two are written up in §9, whose first and third bullets they are: `SDLK_SELECT` is
`SDL_SCANCODE_END`, and `screens::profiles::digit_of` reads ASCII digits out of the scancode field. Both are
`SDL_SCANCODE_END`, and `consts::pin_digit` (the old `screens::profiles::digit_of`) reads ASCII digits out of the scancode field. Both are
misreadings of the same field, both are recorded rather than changed, and the reasons are there.
`is_bound` (§6) declines to inherit the second of them.

Expand Down Expand Up @@ -282,11 +282,11 @@ host's SDL rather than the press. The bare player samples the HUD for bound keys
delivery. A second Back in the same SDL batch sees the first one's dismissal, and an intervening
bound press spends any exit arming. The LG pointer-hidden notification only stops edge scrolling.

**The digit term reads `sym` and not `wcode`, diverging from `screens::profiles::digit_of`, on purpose.**
**The digit term reads `sym` and not `wcode`, diverging from `consts::pin_digit` (the old `screens::profiles::digit_of`), on purpose.**
48–57 in the scancode field are `]` `\` `#` `;` `'` `` ` `` `,` `.` `/` and CapsLock (the digits'
scancodes are 30–39, which is how 33/34 turned out to be `4` and `5` in the first place). Mirroring
`digit_of` would have put the retired mis-reading straight back inside the gate that exists to stop
it. The consequence is that `is_bound` is not a strict superset of `digit_of` for a wcode-only
`pin_digit` would have put the retired mis-reading straight back inside the gate that exists to stop
it. The same term is `action_of`'s `Action::Digit`, which `is_bound` is now defined by. The consequence is that `is_bound` is not a strict superset of `pin_digit` for a wcode-only
punctuation press — which is harmless, because the PIN pad has neither a HUD nor an armed click.

Three things stay unconditional, each for its own reason. `held.down_sym` is bookkeeping about the
Expand Down Expand Up @@ -432,10 +432,10 @@ reproduce rather than a rule to obey by quitting.
`SDL_SCANCODE_RETURN`, captured and bound.
* **§4.2** — `19` is `SDL_SCANCODE_P` and is bound to PLAY. Untested on a device; needs a USB
keyboard as well as §7.
* **`screens::profiles`' `digit_of` reads the digit range in `wcode` too**, where 48–57 are not digits at
* **`consts::pin_digit` (moved from `screens::profiles::digit_of`) reads the digit range in `wcode` too**, where 48–57 are not digits at
all but `]` `\` `#` `;` `'` `` ` `` `,` `.` `/` and CapsLock — and its own test asserts
`digit_of(0, 55) == Some(b'7')`, where scancode 55 is a full stop. No remote has those keys, so it
is harmless in practice and `screens/profiles.rs` is left alone here; a USB keyboard on the PIN screen
`pin_digit(0, 55) == Some(b'7')`, where scancode 55 is a full stop. No remote has those keys, so it
is harmless in practice and the reader moved down to `consts` unchanged; a USB keyboard on the PIN screen
would type digits from punctuation. `is_bound` deliberately does **not** mirror it (§6). The same
capture settles both.
* **`461` and `156` are not producible from the evdev table.** 156 is explained — the panel's *Clear
Expand Down
14 changes: 3 additions & 11 deletions rust-modules/screens/src/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
//! **The digits are handled in `step`; no raw `key(sym)` function survives** (spec open question
//! 2). A number key types straight into the PIN without moving the visual cursor (the remote's
//! digit buttons carry the same 48-57 ASCII range in `sym`/`wcode` the legacy `digit_of` read, and
//! that pure function is unchanged); OK on a keypad cell presses whatever cell the cursor is on,
//! that pure function is unchanged and now lives in `plx_ui::consts` as `pin_digit`); OK on a keypad
//! cell presses whatever cell the cursor is on,
//! delivered as an ordinary `ScreenEvent::Activate` — the keys are `ElemKind::Bare`, so the engine
//! fires that on the key-DOWN edge with no press arm at all, exactly as a `Card`/`Control` MUST
//! NOT (see the next paragraph).
Expand Down Expand Up @@ -335,15 +336,6 @@ fn pin_flash(error_s: f32) -> Option<bool> {
(error_s > 0.0).then(|| (((PIN_ERR_S - error_s) / PIN_ERR_HALF_S) as i32) % 2 == 0)
}

/// Remote number key → keypad digit, ported verbatim: SDL gives a printable key its ASCII sym and
/// the webOS remote's number buttons carry the same 48-57 ('0'-'9') range in `wcode`.
fn digit_of(sym: u32, wcode: u32) -> Option<u8> {
[sym, wcode]
.into_iter()
.find(|v| (48..=57).contains(v))
.map(|v| v as u8)
}

/// Avatar-row geometry: (first tile's left x before scroll, per-tile stride). Centred when the
/// roster fits, else left-aligned so `CardRow` can scroll it. No `Measure` needed — every input is
/// a fixed style constant or the roster count. Ported verbatim from `ui/profiles.rs::row_geom`.
Expand Down Expand Up @@ -1773,7 +1765,7 @@ impl<H: AuthLike> Machine<H> for ProfilesScreen {
// own `pad_key`
return Handled::Yes;
}
if let Some(d) = digit_of(*sym, *wcode) {
if let Some(d) = plx_ui::consts::pin_digit(*sym, *wcode) {
self.press(d, fx);
return Handled::Yes;
}
Expand Down
44 changes: 30 additions & 14 deletions rust-modules/screens/src/profiles_pin_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,11 @@ fn closing_pin_publishes_the_closed_state_before_the_next_tick() {
}

// ---------------------------------------------------------------------------------------
// pin_flash / digit_of — pure, ported verbatim from `ui/profiles.rs`
// pin_flash — pure, ported verbatim from `ui/profiles.rs`. The digit reader that used to sit beside
// it, `digit_of`, is now `plx_ui::consts::pin_digit`, and its table is graded there
// (`consts::action_tests`); the keypad's own reading of a wcode-only press is graded below.
// ---------------------------------------------------------------------------------------

#[test]
fn a_pin_digit_is_read_from_either_field() {
assert_eq!(digit_of(b'7' as u32, 0), Some(b'7'), "a dev keyboard's sym");
assert_eq!(
digit_of(0, 55),
Some(b'7'),
"the remote's wcode, same digit"
);
assert_eq!(digit_of(b'0' as u32, 0), Some(b'0'));
assert_eq!(digit_of(999, 0), None, "not a digit in either field");
}

/// A 1.4s error window reads as several distinct red pulses, not one — the assertion a static
/// tint fails no matter how red it is. Ported from `ui/profiles.rs`'s own property test,
/// minus the `plx_machine::idle` half (this screen reports through `Effects` instead — see the next
Expand Down Expand Up @@ -329,10 +319,36 @@ fn a_digit_key_types_into_the_entry_and_backspace_removes_one() {
None,
);
assert_eq!(s.pad.entry, "127");
// backspace via the delete cell's OWN digit path is not reachable through `digit_of` (it
// backspace via the delete cell's OWN digit path is not reachable through `pin_digit` (it
// is not in 48..=57) — `press` handles it directly, exercised below through `Activate`.
}

/// **Each number key types its own digit, and a wcode-only press keeps typing it.** The pairs are
/// the ones the keypad is sent as `InputKind::Key { sym, wcode }`, written out as literals: a
/// printable key's ASCII sym with or without the television's scancode beside it (the number
/// buttons are sym `'5'` with scancode 34: the sym is the digit and the scancode is not), and the
/// pair with NO digit sym and a wcode in 48..=57, which `pin_digit` still reads (the keypad's
/// reading, deliberately wider than `is_remote_bound`'s: `docs/remote-keys.md` section 9). Nothing
/// else types: the neighbours of both ranges, an unbound key, and a press that names no key.
#[test]
fn native_key_effect_pin_digits_type_their_own_digit() {
for digit in 0u32..=9 {
let typed = |sym: u32, wcode: u32| {
let mut s = bare(Pad::opened(0));
step_ev(&mut s, &key_down(Key::Other, sym, wcode), None);
s.pad.entry
};
assert_eq!(typed(48 + digit, 0), digit.to_string(), "sym '{digit}'");
assert_eq!(typed(48 + digit, 30 + digit), digit.to_string(), "sym '{digit}' with its scancode beside it");
assert_eq!(typed(0, 48 + digit), digit.to_string(), "wcode {} alone", 48 + digit);
}
for (sym, wcode) in [(47, 0), (58, 0), (0, 47), (0, 58), (0, 0), (0, 504), (0x4000_0051, 0), (0, 450), (0, 72)] {
let mut s = bare(Pad::opened(0));
step_ev(&mut s, &key_down(Key::Other, sym, wcode), None);
assert_eq!(s.pad.entry, "", "({sym}, {wcode}) types nothing");
}
}

/// Backspace and typing-again both cancel a running wrong-PIN flash — `press`'s own first
/// line, ported from `ui/profiles.rs`.
#[test]
Expand Down
2 changes: 1 addition & 1 deletion rust-modules/src/app/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5325,7 +5325,7 @@ pub(crate) fn search_owns_input(d: &Dispatcher<AppHost>) -> bool {
/// television's own keyboard through `SDL_TEXTINPUT`, a replayed text input). True while the system keyboard is
/// up for whichever page or surface raised it (`Dispatcher::system_keyboard_up`: Settings > Player HUD's address
/// field, and Search's), and while Search is on top, whose field takes text even when the dispatcher's record of
/// the panel disagrees with the OS (the `SDL_TEXTINPUT` branch of `run::ingest_sdl_event` says why). Text that
/// the panel disagrees with the OS (`run::ingest_text_commit` says why). Text that
/// arrives while this is false goes to `textinput`'s bounded queue, which nothing reads.
pub(crate) fn text_owner(d: &Dispatcher<AppHost>) -> bool {
d.system_keyboard_up() || search_owns_input(d)
Expand Down
Loading
Loading