MainMenu: Allow components to directly handle shortcut keys which trigger menu items
This fixes a regression introduced by 6e9261ea which meant that components were not given a chance to respond to shortcut keypresses if those same keypresses were registered for a menu item. This resulted in behaviour where shortcuts such as 'cmd+c' would not be passed to a focused TextEditor if a different command with the same shortcut was registered in the main menu. With this change in place, we now check whether the menu item's shortcut keys match the current event's pressed keys. If the keypresses match, we can assume that the event was triggered by the keyboard, and dispatch the keypresses to the ComponentPeer. If the keypresses do not match, then the menu item was likely selected using space/return, or by clicking, in which case the event is dispatched directly to the ApplicationCommandManager.
Please register or sign in to comment