Obscure bug with NSVIewComponentPeer::keyDown vs performKeyEquivalent


#1

It seems there's at least one odd case where performKeyEquivalent works and keyDown doesn't.  Using the Plugin Host Demo and the native mac menu do the following:

1.Change "save" command to use "-" (dash/hyphen whatever).   ( command+"-"  )

2.Change "save as" to use "_" (underscore).  ( command+shift+"_" )

3.Remove "save as" from the menu item list.

4.Set "save" menu item "active" to false.  ("save as" remains active)

Result:  "save as" key command no longer works.  keydown does not get called.  performKeyEquivalent still does (although defined out for 10.5+)

Notes:

1. If both items are shown in the menu, the "save as" will work while "save" is disabled

2. JuceMainMenuHandler::addMenuItem uses setKeyEquivalent and setKeyEquivalentModifierMask even though performKeyEquivalent is disabled for 10.5+

4. performKeyEquivalent doesn't appear to have been deprecated by Apple.  The define's have been in for a long time.  Was/is there some documentation that suggests it's no longer necessary? According to their docs it appears to remain a valid handling mechanism that had additional handling added with keyDown in 10.5+.

From: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html#//apple_ref/doc/uid/10000060i-CH7-SW1

Note: Beginning with OS X v10.5, if a key equivalent is not recognized, NSWindow sends it as an NSKeyDown event to the first responder. This behavior enables custom key-binding entries with Command-key modifiers. In addition, NSApplicationsends a Control-key event to the key window via performKeyEquivalent: before sending it as an NSKeyDown event through the responder chain. This behavior allows more reliable use of Control-key events as menu key equivalents.

EDIT: this is with latest juce as of this posting (-5 hours).  I'm on Mavericks (10.9.4) using 10.9 sdk