From 306de0998715ef8043c4e26cbb1dc73f784f815b Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 12 Jan 2026 16:34:30 +0100 Subject: [PATCH] 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 --- src/Fl_cocoa.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 14f9a557b..282bc4ecc 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -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];