<AWT Dev> [8] Review request for JDK-8020209: [macosx] Mac OS X key event confusion for "COMMAND PLUS"

Leonid Romanov leonid.romanov at oracle.com
Tue Sep 10 08:56:43 PDT 2013

Adding awt-dev to CC.

I've added a regression test. It should fire if Apple ever decide to remove or alter the SPI I use. Btw, I've tested the fix on 10.9 and it works fine there.


On Sep 9, 2013, at 11:58 PM, Anthony Petrov <anthony.petrov at oracle.com> wrote:

> Hi Leonid,
> This should be reviewed on awt-dev at . The macosx-port project has reached its goal long time ago, so the macosx-port-dev@ mailing list is pretty useless currently.
> As for the fix itself, even though I prefer to avoid using private APIs usually, given that both Chrome and Mozilla do that, I think it's OK in this case. Besides, the code looks a lot simpler and clearer now. So the fix looks good to me.
> BTW, can a test be written to cover all the mentioned issues so that we could catch any problems later (e.g., in case OS X stops supporting the SPI, or we break our own code ourselves).
> --
> best regards,
> Anthony
> On 09/09/2013 03:20 PM, Leonid Romanov wrote:
>> Hello,
>> This is a bug with a long history. It all started with 1* followed by 2*. What looked like a perfectly fine approach back then has caused us a number of problems ever since, like 3* and all the other similar menu related issues that followed. JDK-8020209 is the latest in the series. What happens in  JDK-8020209 is that Cocoa calls -performKeyEquivalent twice: first for "Cmd =" followed by the call for "Cmd +".
>> If you look at all these bugs, it will become evident that the crux of the problem is that we use  -performKeyEquivalent to intercept key events that don't go through -keyDown, so this patch is an attempt to fix it. In order to make these events to go through -keyDown, I have to override a SPI method, like Mozilla and Chrome do. I couldn't find any other way to achieve it. As for whether it would be considered as Private API usage, I've already asked this question on macosxport-dev mailing list, see 4*. The answer was that I need to submit private JDK build to the App Store and see if it gets accepted. I'l do do it if reviewers agree with my fix.
>> I gave this fix limited testing by running a number of regression tests and Netbeans, and haven't found any issues with it.
>> Bug: http://bugs.sun.com/view_bug.do?bug_id=8020209
>> Webrev: http://cr.openjdk.java.net/~leonidr/8020209/webrev.00/
>> 1. http://bugs.sun.com/view_bug.do?bug_id=7131196
>> 2. http://bugs.sun.com/view_bug.do?bug_id=7142565
>> 3. http://bugs.sun.com/view_bug.do?bug_id=7160951
>> 4. http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-September/004849.html
>> Thanks,
>> Leonid.

More information about the awt-dev mailing list