@@ -7,6 +7,8 @@ use crate::{DecodedKey, HandleControl, KeyCode, KeyboardLayout, Modifiers};
7
7
/// The top row spells `AZERTY`.
8
8
///
9
9
/// Has a 2-row high Enter key, with Oem5 next to the left shift (ISO format).
10
+ ///
11
+ /// NB: no "dead key" support for now
10
12
pub struct Azerty ;
11
13
12
14
impl KeyboardLayout for Azerty {
@@ -19,12 +21,12 @@ impl KeyboardLayout for Azerty {
19
21
let map_to_unicode = handle_ctrl == HandleControl :: MapLettersToUnicode ;
20
22
match keycode {
21
23
KeyCode :: Escape => DecodedKey :: Unicode ( 0x1B . into ( ) ) ,
22
- // Works with Unicode & 850 code page, not 437
24
+ // Works with Unicode & 850 code page, not 437 that has neither ¹ or ³
23
25
KeyCode :: Oem8 => {
24
26
if modifiers. is_shifted ( ) {
25
- DecodedKey :: Unicode ( '³' ) // Not in 437 code page
27
+ DecodedKey :: Unicode ( '³' )
26
28
} else if modifiers. is_altgr ( ) {
27
- DecodedKey :: Unicode ( '¹' ) // Not in 437 code page
29
+ DecodedKey :: Unicode ( '¹' )
28
30
} else {
29
31
DecodedKey :: Unicode ( '²' )
30
32
}
@@ -46,6 +48,7 @@ impl KeyboardLayout for Azerty {
46
48
}
47
49
}
48
50
KeyCode :: Key1 => {
51
+ // NB: ˇ & ˛ dead keys with AltGr (+ Shift)
49
52
if modifiers. is_shifted ( ) {
50
53
DecodedKey :: Unicode ( '1' )
51
54
} else {
@@ -63,6 +66,7 @@ impl KeyboardLayout for Azerty {
63
66
}
64
67
}
65
68
KeyCode :: Key3 => {
69
+ // NB: ˘ dead key with AltGr + Shift
66
70
if modifiers. is_shifted ( ) {
67
71
DecodedKey :: Unicode ( '3' )
68
72
} else if modifiers. is_altgr ( ) {
@@ -264,6 +268,7 @@ impl KeyboardLayout for Azerty {
264
268
}
265
269
}
266
270
KeyCode :: Oem4 => {
271
+ // NB: these should be dead keys
267
272
if modifiers. is_shifted ( ) {
268
273
DecodedKey :: Unicode ( '¨' )
269
274
} else if modifiers. is_altgr ( ) {
@@ -283,6 +288,7 @@ impl KeyboardLayout for Azerty {
283
288
}
284
289
}
285
290
KeyCode :: Oem7 => {
291
+ // NB: ´ & ¯ dead keys can be done with AltGr (+ Shift)
286
292
if modifiers. is_shifted ( ) {
287
293
DecodedKey :: Unicode ( 'µ' )
288
294
} else {
@@ -390,6 +396,7 @@ impl KeyboardLayout for Azerty {
390
396
}
391
397
}
392
398
KeyCode :: Oem3 => {
399
+ // NB: ´ dead key & Ù can be done with AltGr (+ Shift), but no Ù in code page 437
393
400
if modifiers. is_shifted ( ) {
394
401
DecodedKey :: Unicode ( '%' )
395
402
} else {
@@ -493,9 +500,15 @@ impl KeyboardLayout for Azerty {
493
500
}
494
501
KeyCode :: Spacebar => DecodedKey :: Unicode ( ' ' ) ,
495
502
KeyCode :: Delete => DecodedKey :: Unicode ( 127 . into ( ) ) ,
503
+ // NB: these ones give respectively ÷, × & − with AltGr
496
504
KeyCode :: NumpadDivide => DecodedKey :: Unicode ( '/' ) ,
497
505
KeyCode :: NumpadMultiply => DecodedKey :: Unicode ( '*' ) ,
498
506
KeyCode :: NumpadSubtract => DecodedKey :: Unicode ( '-' ) ,
507
+ // NB: this is interesting with AltGr or AltGr+Shift, but Unicode only
508
+ // 7: ↖⇖ 8: ↑⇑ 9:↗⇗
509
+ // 4: ←⇐ 5: ↔⇔ 6:→⇒
510
+ // 1: ↙⇙ 2: ↓⇓ 3:↘⇘
511
+ // 0: ↕⇕ .: , (space: e2 80 af in UTF-8)
499
512
KeyCode :: Numpad7 => {
500
513
if modifiers. numlock {
501
514
DecodedKey :: Unicode ( '7' )
@@ -517,6 +530,7 @@ impl KeyboardLayout for Azerty {
517
530
DecodedKey :: RawKey ( KeyCode :: PageUp )
518
531
}
519
532
}
533
+ // NB: this one gives nothing different with AltGr
520
534
KeyCode :: NumpadAdd => DecodedKey :: Unicode ( '+' ) ,
521
535
KeyCode :: Numpad4 => {
522
536
if modifiers. numlock {
@@ -602,6 +616,10 @@ mod test {
602
616
k. process_keyevent( KeyEvent :: new( KeyCode :: Key4 , KeyState :: Down ) ) ,
603
617
Some ( DecodedKey :: Unicode ( '\'' ) )
604
618
) ;
619
+ assert_eq ! (
620
+ k. process_keyevent( KeyEvent :: new( KeyCode :: Oem5 , KeyState :: Down ) ) ,
621
+ Some ( DecodedKey :: Unicode ( '<' ) )
622
+ ) ;
605
623
assert_eq ! (
606
624
k. process_keyevent( KeyEvent :: new( KeyCode :: Oem7 , KeyState :: Down ) ) ,
607
625
Some ( DecodedKey :: Unicode ( '*' ) )
0 commit comments