Restore use of Cmd-+ under macOS with the US keyboard layout and others (#1454)

This commit is contained in:
ManoloFLTK
2026-06-13 16:11:55 +02:00
parent ee3ba84aef
commit b31902e7cb
2 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -102,8 +102,8 @@ typedef enum {
/// When switched on and when the keyboard in use has '+' in the shifted position of its key,
/// pressing that key and ctrl triggers the zoom-in operation.
/// When switched off (default), the zoom-in operation requires that also the shift key is pressed.
/// Under macOS, this option has no effect because the OS itself generates ⌘= followed
/// by ⌘+ when pressing ⌘ and the '=|+' key without pressing shift.
/// Under macOS, this option has no effect with some keyboard layouts because the OS itself
/// generates ⌘= followed by ⌘+ when pressing ⌘ and the '=|+' key without pressing shift.
OPTION_SIMPLE_ZOOM_SHORTCUT,
// don't change this, leave it always as the last element
+10 -2
View File
@@ -2092,7 +2092,8 @@ static void q_set_window_title(NSWindow *nsw, const char * name, const char *mi
Keyboard input sends keyDown: and performKeyEquivalent: messages to myview. The latter occurs for keys such as
ForwardDelete, arrows and F1, and when the Ctrl or Cmd modifiers are used. Other key presses send keyDown: messages.
The performKeyEquivalent: method directly calls Fl::handle(FL_KEYBOARD, focus-window) and returns always YES.
The performKeyEquivalent: method directly calls Fl::handle(FL_KEYBOARD, focus-window) and generally returns YES;
it returns NO for some keyboard layouts.
The keyDown: method calls [[myview inputContext] handleEvent:theEvent], and triggers system processing of keyboard events.
Three sorts of messages are then sent back by the system to myview: doCommandBySelector:, setMarkedText: and insertText:.
All 3 messages eventually produce Fl::handle(FL_KEYBOARD, win) calls.
@@ -2343,10 +2344,17 @@ static void cocoaKeyboardHandler(NSEvent *theEvent)
if ( (mods & NSEventModifierFlagControl) && (mods & NSEventModifierFlagCommand) &&
!(mods & (NSEventModifierFlagShift|NSEventModifierFlagOption)) && [pure isEqualToString:@" "] ) {
[NSApp orderFrontCharacterPalette:self];
handled = YES;
} else if ([theEvent keyCode] != 24 || ![s isEqualToString:@"="]) {
// It seems difficult to predict what [theEvent characters] returns for keyboard layouts
// where character '+' is in uppercase and the keystroke is Cmd-Shift-+.
// Some layouts return '+': French, Vietnamese, Russian, Greek, Arabic, Serbian;
// other layouts return '=': US, Korean, Thai. For them, this Kludge is necessary.
handled = YES;
}
}
fl_unlock_function();
return YES;
return (handled ? YES : [super performKeyEquivalent:theEvent]);
}
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent
{