emilk/egui

Tracking issue: improve Key input

Open

#3.653 geöffnet am 28. Nov. 2023

Auf GitHub ansehen
 (23 Kommentare) (6 Reaktionen) (0 zugewiesene Personen)Rust (2.037 Forks)batch import
Tracking issueeframeeguigood first issuehelp wanted

Repository-Metriken

Stars
 (29.051 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 11T 20h) (47 gemergte PRs in 30 T)

Beschreibung

The keyboard input in egui is limited in a couple of ways:

  • Lots of keys missing from Event::Key
  • We don't report the super/meta modifier key
  • We don't report modifier key presses (just their state)
  • Physical keys not reported on the eframe web backend
  • KeyboardShortcut should ignore shift and alt keys for logical keys (e.g. Ctrl Plus may require pressing shift on some keyboards). See https://github.com/emilk/egui/issues/3626 for more

How can I help?

  • Look at the code for egui::Key and follow the instructions there for adding new keys
  • Investigate if we can get physical keycode on web

Requested keys

Prioir art

Relevant issues

Physical vs Logical keys

Consider someone owning a physical QWERTY keyboard:

However, they have remapped it to use Dvorak (perhaps even repainting the text on their keyboard):

If they start hitting Caps Lock and then moving to the left, the keys they will be hitting will be

  • physical (qwerty): CapsLock, A, S, D, F, …
  • logical (Dvorak): CapsLock, A, O, E, U …

The logical keys makes sense for most keyboard shortcuts - if you say "Press Cmd+S to save" in your UI, the user will be looking for the logical key "S" The physical keys are mostly useful for games, where e.g. te physical WSAD on QWERTY moves a character, no matter what the users keymap is.

Contributor Guide