RFR: 8279879: [macos] ActionEvent triggered when right-clicking TrayIcon

Sergey Bylokhov serb at openjdk.java.net
Thu Jan 13 23:43:27 UTC 2022


On Thu, 13 Jan 2022 23:23:20 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> It is platform dependent:
>> https://github.com/openjdk/jdk/blob/d70545d71080d534fefd3c9652656549f689f620/src/java.desktop/share/classes/java/awt/TrayIcon.java#L565-L566
>> Current behavior of OpenJDK is:
>> * Linux sends it on left button click
>> * macOS send it on right button click.
>> * On Windows it can be triggered by a second mouse click on a tray icon(doesn't matter which mouse key is used), left mouse click on the balloon, or enter keypress on it.
>> 
>> https://github.com/openjdk/jdk/blob/d70545d71080d534fefd3c9652656549f689f620/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp#L412-L457
>> 
>> [JDK-8195991](https://bugs.openjdk.java.net/browse/JDK-8195991) introduced this test, but its description does not conform with its code:
>> 
>>> Right clicking on TrayIcon shouldn't trigger ActionEvent when balloon is displayed.
>> 
>> Given the info above this will be true only for Linux, which does not trigger `ACTION_PERFORMED` on right mouse click. 
>> 
>>> int actionPerformedCount = -1;
>> ...
>> if (actionPerformedCount > 0
>> 
>> So the test code expects to receive 0 or 1  `ACTION_PERFORMED` events. It allows the test to pass with our current implementation.
>> 
>> 
>> 
>> The original test was written along with a fix for Windows back in [2005](https://bugs.openjdk.java.net/browse/JDK-6271624). 
>> 
>> The Windows UI have changed since this time, so may be the expectation of not receiving of `ACTION_PERFORMED` is no longer valid.
>
> Thanks!
> @mrserb could I also get your input on this?
> Should I close the PR and resolve the report as "not an issue"?

Yes I think this is not an issue.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7035



More information about the client-libs-dev mailing list