< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -64,10 +64,11 @@
 import sun.awt.SunToolkit;
 import sun.awt.X11GraphicsDevice;
 import sun.awt.X11GraphicsEnvironment;
 import sun.java2d.pipe.Region;
 import sun.util.logging.PlatformLogger;
+import sun.awt.OSInfo;
 
 class XWindowPeer extends XPanelPeer implements WindowPeer,
                                                 DisplayChangedListener {
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWindowPeer");

@@ -118,10 +119,12 @@
      * The type is supposed to be immutable while the peer object exists.
      * The value gets initialized in the preInit() method.
      */
     private Window.Type windowType = Window.Type.NORMAL;
 
+    private static final boolean isAIX = OSInfo.getOSType() == OSInfo.OSType.AIX;
+
     public final Window.Type getWindowType() {
         return windowType;
     }
 
     // It need to be accessed from XFramePeer.

@@ -2022,10 +2025,27 @@
         XToolkit.awtLock();
         try {
             this.visible = visible;
             if (visible) {
                 applyWindowType();
+                if (isAIX) {
+                    /* On Motif Window Manager, non-focusable window should not set WM_TAKE_FOCUS */
+                    XAtomList currentWMProtocols = wm_protocols.getAtomListPropertyList(this);
+                    if (isFocusableWindow()) {
+                        if (!currentWMProtocols.contains(wm_take_focus)) {
+                            currentWMProtocols.add(wm_take_focus);
+                            wm_protocols.setAtomListProperty(this, currentWMProtocols);
+                        }
+                    } else {
+                      if (XWM.isMotif()) {
+                        if (currentWMProtocols.contains(wm_take_focus)) {
+                            currentWMProtocols.remove(wm_take_focus);
+                            wm_protocols.setAtomListProperty(this, currentWMProtocols);
+                        }
+                      }
+                    }
+                }
                 XlibWrapper.XMapRaised(XToolkit.getDisplay(), getWindow());
             } else {
                 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), getWindow());
             }
             XlibWrapper.XFlush(XToolkit.getDisplay());
< prev index next >