-
CSR
-
Resolution: Withdrawn
-
P3
-
None
-
None
-
behavioral
-
minimal
-
Java API, Use or define an environment variable
Summary
Specifics of hiding the popup menu in Wayland.
Problem
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 session this only works inside XWayland(Wayland's X11 server implementation). 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.
Solution
As a workaround, we can hide this menu when the parent popup menu window loses focus. Third-party applications use a similar approach. 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.
Specification
New environment variable used:
WAYLAND_DISPLAY
to detect Wayland system.
Documentation changes:
src/java.desktop/share/classes/java/awt/PopupMenu.java
* (e.g., you add it to a {@code MenuBar}), then you <b>cannot</b>
* call {@code show} on that {@code PopupMenu}.
*
+ * @implNote On Linux systems using Wayland, the popup menu may not be dismissed
+ * by clicking on the decorations of its own parent window
+ * and on some system panels.
+ *
* @author Amy Fowler
*/
public class PopupMenu extends Menu {
src/java.desktop/share/classes/javax/swing/JPopupMenu.java
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
+ * @implNote On Linux systems using Wayland, the popup menu may not be dismissed
+ * by clicking on the decorations of its own parent window
+ * and on some system panels.
+ *
* @author Georges Saab
* @author David Karlton
* @author Arnaud Weber
...
public class JPopupMenu extends JComponent implements Accessible,MenuElement {
- csr of
-
JDK-8280993 [XWayland] Popup is not closed on click outside of area controlled by XWayland
- Resolved