mirror of
https://github.com/fltk/fltk.git
synced 2026-05-11 15:07:58 +08:00
macOS: Fix Fl::event_key() when using non-latin keyboard layouts (#1427)
This commit is contained in:
+3
-2
@@ -2150,10 +2150,11 @@ static void cocoaKeyboardHandler(NSEvent *theEvent)
|
||||
NSString *sim = [theEvent charactersIgnoringModifiers];
|
||||
UniChar one;
|
||||
CFStringGetCharacters((CFStringRef)sim, CFRangeMake(0, 1), &one);
|
||||
// charactersIgnoringModifiers doesn't ignore shift, remove it when it's on
|
||||
if(one >= 'A' && one <= 'Z') one += 32;
|
||||
if (one > 0 && one <= 0x7f && (sym<'0' || sym>'9') ) sym = one;
|
||||
}
|
||||
// sym may contain an uppercase letter, e.g. with non-latin keyboard layout and ctrl/cmd,
|
||||
// replace uppercase letter by lowercase.
|
||||
if (sym >= 'A' && sym <= 'Z') sym += 32;
|
||||
Fl::e_keysym = Fl::e_original_keysym = sym;
|
||||
/*NSLog(@"cocoaKeyboardHandler: keycode=%08x keysym=%08x mods=%08x symbol=%@ (%@)",
|
||||
keyCode, sym, mods, [theEvent characters], [theEvent charactersIgnoringModifiers]);*/
|
||||
|
||||
Reference in New Issue
Block a user