ravynos icon indicating copy to clipboard operation
ravynos copied to clipboard

NSMenu key accelerators not working

Open mszoek opened this issue 3 years ago • 1 comments

Noticed that keyboard accelerators like Cmd-Q/Ctrl-Q for Quit are not working with the global menu bar. Possibly the keyboard focus is on the menu window, but nothing is processing keyboard input? We should maybe grab any keystrokes and pass them back to the app the same way as item clicks.

mszoek avatar Jul 02 '22 19:07 mszoek

I concur, ~NSMenu is~ All NSApplications are an NSResponder after all, so main menus (**via [[NSApplication sharedApplication] menu] calls) 'should' be reachable in the NSEvent loops for consistency from NSApplication.

EDIT: I have a partial fix in the works as part of GHI #518 ... and turns out the menu is NOT an NSResponder Rather NSResponders have NSMenus so the chain would need to go to the [NSApplication sharedApplication]/NSAPP (which actually is an NSResponder and then during the Application's default performKeyEquivalent: implementation the application should call its own [self menu]'s performKeyEquivalent: with the event)

Albeit, my partial fix only impacts the NSMenu side when receiving events, not the rest of the event chain.


For my own ref (custodial):

[!IMPORTANT] I'm still familiarizing myself with the project, :bow: I appreciate your time, and efforts on this!

Considering these 'menu windows' (NSMenu would be (in the future?) expected to be a NSView like object for compatibility with mac apps :shrug:) if they are NSWindows, perhaps they should be initialized/set so they have the NSMenu delegate as the 'FirstResponder' and those delegates set the window/app as the 'NextResponder' to close the loop? (of-course idea needs more design)

Apple event loop workings:

reactive-firewall avatar Sep 12 '25 20:09 reactive-firewall