On Tue, 9 May 2023 18:01:31 GMT, Alexander Zvegintsev <azveg...@openjdk.org> wrote:
>> On Linux systems, we rely on XGrabPointer (X11 API) to capture mouse input >> and dismiss popup menus on mouse clicks outside the popup menu. >> Unfortunately, on Linux systems using the >> [Wayland](https://wayland.freedesktop.org/) session this only works inside >> [XWayland(Wayland's X11 server >> implementation)](https://wayland.freedesktop.org/xserver.html). >> This means if a user clicks on a part of the screen not controlled by >> XWayland (e.g. window decorations, other non X11 applications) the popup >> menu will not be hidden. >> >> As a workaround, we can hide this menu when the parent popup menu window >> loses focus. >> However, it does have its drawbacks, which should be described in the >> documentation.The focus does not change when clicking on the header of its >> own parent window or on non-focusable windows, .e.g., empty space in system >> dock, so in this case the popup menu is not hidden. >> >> Third-party applications use a similar approach. >> >> I also have doubts about the need to change the documentation, as I can't >> find where it is described that the popup menu should be hidden when clicked >> outside the menu. >> >> <del>CSR: https://bugs.openjdk.org/browse/JDK-8307529</del> > > Alexander Zvegintsev has updated the pull request incrementally with one > additional commit since the last revision: > > undo documentation changes src/java.desktop/share/classes/java/awt/PopupMenu.java line 49: > 47: * by clicking on the decorations of its own parent window > 48: * and on some system panels. > 49: * I think I agree with others that its questionable if we need to say this at all. It would be odd to specify the places you can click to dismiss a popup, so unless we already do that, we don't need to start now. src/java.desktop/share/classes/javax/swing/JPopupMenu.java line 767: > 765: } > 766: > 767: // We rely on the X11 input grab mechanism, but for the Wayland > session Whilst we need to do this, having all this code discussing Wayland here in JPopupMenu is really the wrong place. This needs to be re-done in a way that is about the specific problem which is something like SunToolkit.clickOutsideWillDismissPopup() and the word "Wayland" shouldn't appear anywhere here. IIUC this fix is needed so that a number of tests that fail now because of this problem will be able to pass, so it would be good to get it in soon so I can get a clearer picture of what remaining test issues we have. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13830#discussion_r1187870382 PR Review Comment: https://git.openjdk.org/jdk/pull/13830#discussion_r1198364501