macos: halt NSEvent processing at app scope only if event is handled (#4691)

Fixes #4677
This commit is contained in:
Mitchell Hashimoto
2025-01-06 07:28:04 -08:00
committed by GitHub

View File

@ -430,9 +430,16 @@ class AppDelegate: NSObject,
ghostty_app_key_is_binding( ghostty_app_key_is_binding(
app, app,
event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) { event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) {
ghostty_app_key(app, event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) // If the key was handled by Ghostty we stop the event chain. If
// the key wasn't handled then we let it fall through and continue
// processing. This is important because some bindings may have no
// affect at this scope.
if (ghostty_app_key(
app,
event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS))) {
return nil return nil
} }
}
// If this event would be handled by our menu then we do nothing. // If this event would be handled by our menu then we do nothing.
if let mainMenu = NSApp.mainMenu, if let mainMenu = NSApp.mainMenu,