On Mon, 20 Jan 2025 01:08:01 GMT, Alexander Zvegintsev <azveg...@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 557:

> 555:                             }
> 556:                             owner = owner.getOwner();
> 557:                         }

Suggestion:


                        Window owner = window.getOwner();
                        while (owner != null) {
                            if (owner == oppositeWindow) {
                                return;
                            }
                            owner = owner.getOwner();
                        }


I'd also add blank lines around this piece of code to break it into smaller 
pieces.

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

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

Reply via email to