1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Add F21 to F35 key bindings (#4004)

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* Closes <https://github.com/emilk/egui/issues/3990>

`winit` supports up to F35, so thought it was better to just add them
all.
This commit is contained in:
Oscar Gustafsson
2024-02-08 10:57:32 +01:00
committed by GitHub
parent 21f08afcbb
commit 15370bbea0
2 changed files with 91 additions and 1 deletions

View File

@@ -1055,6 +1055,21 @@ fn key_from_named_key(named_key: winit::keyboard::NamedKey) -> Option<egui::Key>
NamedKey::F18 => Key::F18,
NamedKey::F19 => Key::F19,
NamedKey::F20 => Key::F20,
NamedKey::F21 => Key::F21,
NamedKey::F22 => Key::F22,
NamedKey::F23 => Key::F23,
NamedKey::F24 => Key::F24,
NamedKey::F25 => Key::F25,
NamedKey::F26 => Key::F26,
NamedKey::F27 => Key::F27,
NamedKey::F28 => Key::F28,
NamedKey::F29 => Key::F29,
NamedKey::F30 => Key::F30,
NamedKey::F31 => Key::F31,
NamedKey::F32 => Key::F32,
NamedKey::F33 => Key::F33,
NamedKey::F34 => Key::F34,
NamedKey::F35 => Key::F35,
_ => {
log::trace!("Unknown key: {named_key:?}");
return None;
@@ -1161,6 +1176,21 @@ fn key_from_key_code(key: winit::keyboard::KeyCode) -> Option<egui::Key> {
KeyCode::F18 => Key::F18,
KeyCode::F19 => Key::F19,
KeyCode::F20 => Key::F20,
KeyCode::F21 => Key::F21,
KeyCode::F22 => Key::F22,
KeyCode::F23 => Key::F23,
KeyCode::F24 => Key::F24,
KeyCode::F25 => Key::F25,
KeyCode::F26 => Key::F26,
KeyCode::F27 => Key::F27,
KeyCode::F28 => Key::F28,
KeyCode::F29 => Key::F29,
KeyCode::F30 => Key::F30,
KeyCode::F31 => Key::F31,
KeyCode::F32 => Key::F32,
KeyCode::F33 => Key::F33,
KeyCode::F34 => Key::F34,
KeyCode::F35 => Key::F35,
_ => {
return None;