macOS: Fix Fl::event_key() when using non-latin keyboard layouts (#1427)
Build and Test / build-linux (push) Has been cancelled
Build and Test / build-wayland (push) Has been cancelled
Build and Test / build-macos (push) Has been cancelled
Build and Test / build-windows (push) Has been cancelled

This commit is contained in:
ManoloFLTK
2026-05-04 09:50:06 +02:00
parent 4f9d7794f8
commit 0fe9b6ccde
+3 -2
View File
@@ -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]);*/