RFR: 8342096: Popup menus that request focus are not shown on Linux with Wayland [v2]

Alexey Ivanov aivanov at openjdk.org
Mon Jan 20 19:53:39 UTC 2025


On Mon, 20 Jan 2025 01:00:26 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> As far as my tests with an instrumented build show - yes, but I discovered another case not covered:
>> 
>> 
>> for (int i = 0; i <= 1; i++) {
>>     JMenu menu = new JMenu("Menu " + i);
>>     menu.add(new JTextField("JTextField " + i));
>>     popupMenu.add(menu);
>> }
>> 
>> 
>> Clicking on gnome text editor does not hide the menu if the second menu is open. I do have a fix for it, but will not rush to post it, as I do not have enough time to test it thoroughly.
>> I will move this PR to draft status as I will be on vacation starting next week.
>
> Updated to cover this case by adding the listener to all owned windows.

I'm still unconvinced the listener is always removed…

Shouldn't the line below

https://github.com/openjdk/jdk/blob/b60a33269247c1039fa0ec6cd99476c9f8976852/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java#L563

be changed to call `dismissPopupOnFocusLostIfNeededCleanUp` to remove the listener from the popup and its children?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22729#discussion_r1922788471


More information about the client-libs-dev mailing list