kas-gui / kas

Another GUI toolkit
Apache License 2.0
892 stars 27 forks source link

Replace Event::Text with Event::Key #404

Closed dhardy closed 10 months ago

dhardy commented 10 months ago

This lets widgets get direct access to Winit's new key events and fixes issues conflating text entry with shortcuts or control characters.

See also https://github.com/rust-windowing/winit/issues/3038. This impl directly modifies event.text but we should probably align with Winit.

Edit to clarify: this code sets KeyEvent::Text to None where the text would be non-printable (control codes) or should only be matched as a shortcut (due to usage of Ctrl/Super/Alt keys). This approach may need to be changed.