Restore emojis support under recent macOS versions - cont'd (#1360)

This makes FLTK open the character palette when typing Ctrl+Command+Space or Function+e
This commit is contained in:
ManoloFLTK
2026-01-12 16:34:30 +01:00
parent 69669256d4
commit 306de09987

View File

@@ -1,7 +1,7 @@
//
// macOS-Cocoa specific code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2025 by Bill Spitzak and others.
// Copyright 1998-2026 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -2575,10 +2575,18 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
if ([[self window] firstResponder] != self) {
return NO;
}
NSUInteger mods = [theEvent modifierFlags];
NSString *pure = [theEvent charactersIgnoringModifiers];
// detect Ctrl+Command+Space or Function+e to open character palette
if ( (( (mods & NSEventModifierFlagControl) && (mods & NSEventModifierFlagCommand) &&
!(mods & (NSEventModifierFlagShift|NSEventModifierFlagOption)) && [pure isEqualToString:@" "] ) ) ||
( (mods & NSEventModifierFlagFunction) && [pure isEqualToString:@"e"] ) ) {
[NSApp orderFrontCharacterPalette:self];
return YES;
}
fl_lock_function();
cocoaKeyboardHandler(theEvent);
BOOL handled;
NSUInteger mods = [theEvent modifierFlags];
Fl_Window *w = [(FLWindow*)[theEvent window] getFl_Window];
if ( (mods & NSEventModifierFlagControl) || (mods & NSEventModifierFlagCommand) ) {
NSString *s = [theEvent characters];