On Wed, 12 Jan 2022 22:54:45 GMT, Alexander Zvegintsev <azveg...@openjdk.org> wrote:
>> Oh, I misunderstood the test. Based on a previous version of this test that >> was failing I thought the issue was the ActionEvent firing on a TrayIcon >> right-click that also brought up the balloon message.. >> >> I have a few questions about the expected behavior of TrayIcon: >> Should ActionEvent be triggered on a normal left-click? How about a normal >> right-click? >> When should ActionEvent not be triggered? Not on right-click during a >> balloon message? What about left-click during a balloon message? > > 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"? ------------- PR: https://git.openjdk.java.net/jdk/pull/7035