File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1144,6 +1144,8 @@ fn key_from_named_key(named_key: winit::keyboard::NamedKey) -> Option<egui::Key>
1144
1144
NamedKey :: F33 => Key :: F33 ,
1145
1145
NamedKey :: F34 => Key :: F34 ,
1146
1146
NamedKey :: F35 => Key :: F35 ,
1147
+
1148
+ NamedKey :: BrowserBack => Key :: BrowserBack ,
1147
1149
_ => {
1148
1150
log:: trace!( "Unknown key: {named_key:?}" ) ;
1149
1151
return None ;
Original file line number Diff line number Diff line change @@ -183,6 +183,11 @@ pub enum Key {
183
183
F33 ,
184
184
F34 ,
185
185
F35 ,
186
+
187
+ /// Back navigation key from multimedia keyboard.
188
+ /// Android sends this key on Back button press.
189
+ /// Does not work on Web.
190
+ BrowserBack ,
186
191
// When adding keys, remember to also update:
187
192
// * crates/egui-winit/src/lib.rs
188
193
// * Key::ALL
@@ -307,6 +312,8 @@ impl Key {
307
312
Self :: F33 ,
308
313
Self :: F34 ,
309
314
Self :: F35 ,
315
+ // Navigation keys:
316
+ Self :: BrowserBack ,
310
317
] ;
311
318
312
319
/// Converts `"A"` to `Key::A`, `Space` to `Key::Space`, etc.
@@ -435,6 +442,8 @@ impl Key {
435
442
"F34" => Self :: F34 ,
436
443
"F35" => Self :: F35 ,
437
444
445
+ "BrowserBack" => Self :: BrowserBack ,
446
+
438
447
_ => return None ,
439
448
} )
440
449
}
@@ -588,6 +597,8 @@ impl Key {
588
597
Self :: F33 => "F33" ,
589
598
Self :: F34 => "F34" ,
590
599
Self :: F35 => "F35" ,
600
+
601
+ Self :: BrowserBack => "BrowserBack" ,
591
602
}
592
603
}
593
604
}
@@ -596,7 +607,7 @@ impl Key {
596
607
fn test_key_from_name ( ) {
597
608
assert_eq ! (
598
609
Key :: ALL . len( ) ,
599
- Key :: F35 as usize + 1 ,
610
+ Key :: BrowserBack as usize + 1 ,
600
611
"Some keys are missing in Key::ALL"
601
612
) ;
602
613
You can’t perform that action at this time.
0 commit comments