Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8280993

[XWayland] Popup is not closed on click outside of area controlled by XWayland

    XMLWordPrintable

Details

    • b24

    Description

      We are using XGrabPointer to get mouse input and dismiss popup menus on mouse click.

      Obviously, it does not work when we are trying to mouse click outside of area controlled by XWayland(window's title, desktop, wayland native apss).


       prototype of not perfect workaround

       diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java
      index a19f56249ae..db88ef49f37 100644
      --- a/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java
      +++ b/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java
      @@ -111,6 +111,16 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
               // Get menus from the target.
               Vector<MenuItem> targetItemVector = getMenuTargetItems();
               if (targetItemVector != null) {
      + //TODO: add focus listener only for XWayland
      + target.addFocusListener(new FocusAdapter() {
      + @Override
      + public void focusLost(FocusEvent e) {
      + target.removeFocusListener(this);
      + if (isShowing()) {
      + hide();
      + }
      + }
      + });
                   reloadItems(targetItemVector);
                   //Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang

      For a first look this workaround seems to work reliably except only one case:

      clicking on window's title containing origin component does not lead to focus change, thus we don't hiding popup.

      Attachments

        Issue Links

          Activity

            People

              azvegint Alexander Zvegintsev
              azvegint Alexander Zvegintsev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: