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:38 UTC 2025
On Mon, 20 Jan 2025 01:08:01 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:
>> The previous [JDK-8319103](https://bugs.openjdk.org/browse/JDK-8319103) fix was not complete.
>>
>> The case where a menu item with a focusable component was not a direct child of a window was missing(failing the `if (window == oppositeWindow.getParent() ) {` check), so the ungrab event was posted prematurely.
>>
>> This can be fixed by adding `waylandWindowFocusListener` to all submenus in hierarchy.
>>
>> The manual test updated to use this case, and also added an automated test that checks that it didn't close prematurely.
>
> Alexander Zvegintsev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>
> - Popup may not be dismissed if there are multiple focusable components
> - NestedFocusablePopupTest review comments
> - Merge branch 'master' into 8342096_nested_popup
> - 8342096: Popup menus that request focus are not shown on Linux with Wayland
src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java line 527:
> 525: return false;
> 526: }
> 527: for (WindowFocusListener focusListener : window.getWindowFocusListeners()) {
Suggestion:
}
for (WindowFocusListener focusListener : window.getWindowFocusListeners()) {
I suggest adding a blank line to visually separate the early return logic from the common case one.
test/jdk/javax/swing/JPopupMenu/NestedFocusablePopupTest.java line 146:
> 144: frame = new JFrame("NestedFocusablePopupTest");
> 145: JPanel panel = new JPanel();
> 146: panel.setPreferredSize(new Dimension(200,180));
Suggestion:
panel.setPreferredSize(new Dimension(200, 180));
test/jdk/javax/swing/JPopupMenu/NestedFocusablePopupTest.java line 153:
> 151: getMenuWithMenuItem(true, "focusable subitem");
> 152: menuWithNonFocusableItem =
> 153: getMenuWithMenuItem(false, "non focusable subitem");
Suggestion:
getMenuWithMenuItem(false, "non-focusable subitem");
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22729#discussion_r1922779957
PR Review Comment: https://git.openjdk.org/jdk/pull/22729#discussion_r1922798224
PR Review Comment: https://git.openjdk.org/jdk/pull/22729#discussion_r1922799389
More information about the client-libs-dev
mailing list