Repository navigation
Preserve X11 key-repeat identity across focus changes - #18
TheRenegadeDev wants to merge 6 commits into
Conversation
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the head of the hunk: the X11 event processor gets a FocusKeymap module import, and per the title key-repeat identity is preserved across focus changes: when focus moves between windows (or out and back), a held key's repeat events keep their identity, so the app doesn't see a fresh press (or lose the release) at the change. This is the XInput2 path, which is easy to get wrong, because a focus-in event carries the current key state and the raw events differ from the device events. In this fork the patch should stay small; say whether it is meant for the fork only or is going upstream (and link the upstream issue). A held key whose release arrives after focus is lost must be released in the app (as a synthetic release), not stuck. I did not read the new module. Add tests with synthetic event sequences: press, focus out, focus in, repeat, release; press, focus out, release outside; and a focus change with two keys held. I can't test X11 here. Nothing was run.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
|
@FredApps — response to ReviewerA: This is fork-scoped, targeting the pinned One distinction: the held-key snapshot comes from Core FocusIn/KeymapNotify, captured before XIM filtering. XI2 retains focus/IME ownership; the raw-device path is unchanged. The new module is focus_keymap.rs at I reran its 13 committed tests and three supplementary probes calling that same production policy: 16 passed. The probes exercise press → focus out → focus in → repeat → release → fresh press; release outside followed by return; and two held keys with independent releases, both within one bitmap byte and across bytes. These additional probes are local verification artifacts, not newly committed tests or live X11 dispatch tests. I kept the reviewed commit and dependency pins unchanged because the checks found no repeat-provenance regression. For synthetic releases, Hosted Ubuntu CI compiles this exact winit SHA with X11 enabled and passes all ten GridCraft gates plus the unchanged-lockfile check. There is no standalone winit CI result or live X11/XIM/XEmbed run. I updated the description with the fork scope, current consumer build and these verification limits. |
FredApps
left a comment
There was a problem hiding this comment.
Re-review at 58385004. It's the same head as my Nov 1 comment, so I compared your reply with the code and ran it locally.
Answered:
- Scope: fork-only, for the pinned
migration/egui-037-20261024graph. The description now says so. - Where the snapshot comes from: Core FocusIn/KeymapNotify, taken before XIM filtering. The XI2 raw-device path is unchanged.
- Synthetic release on focus loss:
xinput2_unfocusedkeeps the base's query-keymap releases, and the patch clears the repeat provenance when focus is lost.
Still open:
- The event-sequence tests I asked for aren't committed.
focus_keymap.rshas 13 tests, but the three sequences from my review only exist as your local probes: press → focus out → focus in → repeat → release; press → focus out → release outside → return; and two held keys released separately, in one bitmap byte and across bytes. They call the same production policy, so please commit them tofocus_keymap.rs. Then a later change to the policy can't quietly break them. - Nightly rustfmt (the repo's
fmtjob) fails in this PR's own code. Inx11/event_processor.rs:1042the closure chain and thelet … else { return };need reflowing. Inx11/mod.rs:40,mod focus_keymap;needs to go afterpub mod ffi;.cargo +nightly fmtfixes both.
What I ran on Linux, merged with current migration/egui-037-20261024 (merges cleanly): cargo clippy --all-targets shows no warnings, and cargo test --lib passes all 220 tests. There's no standalone winit CI and no live X11 run for this head.
Once those two points are in, I expect to approve.
Cover held repeats across focus, releases outside, and independent bitmap keys. Apply the requested event-handler and module-order formatting.
|
Follow-up to this review, committed in
Nightly is not installed here, so I could not execute The new tests remain policy-level coverage. They do not prove live X11/XIM/XEmbed callbacks or complete focus-loss release delivery. Your 220-test Linux result and the linked consumer CI cover the predecessor, not this new head. Consumer pins are unchanged. |
FredApps
left a comment
There was a problem hiding this comment.
Re-review at c76a01e8. Both open points from my last review are fixed:
- The event sequences are committed tests now. These are in
focus_keymap.rs:press_focus_out_focus_in_repeat_release_then_fresh_presspress_focus_out_release_outside_then_return_has_no_stale_repeattwo_held_keys_keep_independent_repeat_and_release_state, which covers separate bytes and one byte, released in either order
- Nightly rustfmt.
cargo +nightly fmt --checkpasses on this head now.
What I ran on Linux, with this head merged with current migration/egui-037-20261024 (merges cleanly): cargo clippy --all-targets shows no warnings, and cargo test --lib passes all 223 tests. The CI run for this head (44227516408) is waiting for approval, and that needs a repo admin, so there's still no hosted result. I didn't do a live X11/XIM run either.
Approving.
Summary
Preserve server-ordered X11 focus key state so a held key is not reported as a fresh press after delayed dispatch. Retain native child/XEmbed input attribution and clear repeat provenance on release.
Supports GridCraft #2572, through egui #7 and GridCraft #2675. Targets
migration/egui-037-20261024from pina517b384. This is fork-scoped integration for the pinned GridCraft dependency graph; no separate upstream proposal is part of this PR.Evidence
Current head
c76a01e8eec14023b6f389fc4732dc1d7a370865adds the requested committed regressions and formatting to58385004.focus_keymap.rs: press/focus out/focus in/repeat/release/fresh press; release outside then return; and two held keys released independently within one bitmap byte or across bytes. N/Y, return to the same or another window, and either key-release order are covered. These now live in the repository rather than only in local probes.cargo test --offline --locked --libpasses 17 Windows tests;cargo clippy --offline --locked --all-targets -- -D warningspasses. The existing ignored local lock was reused unchanged. No dependencies or tools were installed or downloaded. Windows library tests do not exercise the X11 dispatcher.ffi/focus_keymapordering are fixed. The policy module passes the available stable rustfmt check; the corrected event hunk matches its formatting output. Nightly is not installed locally, so no local nightly check was run. FredApps now reportscargo +nightly fmt --checkpasses on this head; this is reviewer-run evidence, not a hosted fmt job. Unrelated base formatting that differs under stable's unsupported nightly options was left alone.#[cfg(test)]is byte-identical to58385004. Other production edits are whitespace, one empty-return semicolon and module-declaration ordering. No API, dependency, workflow, changelog or consumer-pin changes. Existing consumers still pin58385004.58385004with X11 enabled and passed all ten app gate stages plus the unchanged-lockfile check. This consumer result covers the predecessor only, not current-head hosted execution or the full standalone platform/toolchain matrix.c76a01e8, confirming both requested changes are fixed. He reports nightly formatting passes on this head, warning-freecargo clippy --all-targets, and 223 Linux library tests passed after merging this head with the current migration branch. These are reviewer-reported results; the local merge SHA/tree was not supplied, and they are not our local Windows runs or hosted CI. CI run 44227516408 is stillaction_requiredwith zero jobs executed, requiring repository-admin action. No hosted result or live X11/XIM run is established.xinput2_unfocusedkeeps the base's query-keymap synthetic releases beforeFocused(false); this patch clears provenance at loss. A delayed query after physical release can already see the key up. The policy tests do not establish a complete per-key callback/release-delivery guarantee.Merge Danger
Door: two-way; code can be reverted.
Blast Radius: X11 keyboard focus and child-window attribution.
Event-ordered state is bounded to tracked windows. Committed regressions cover stale authority, unrelated releases, focus transitions and independent held keys. Current source review found no new behavior in the test/formatting follow-up; it is not an additional independent audit.