< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1672             window.prevTransientFor = transientForWindow;
1673             transientForWindow.nextTransientFor = window;
1674         }
1675         if (!allStates && (window.getWMState() != transientForWindow.getWMState())) {
1676             return;
1677         }
1678         if (window.getScreenNumber() != transientForWindow.getScreenNumber()) {
1679             return;
1680         }
1681         long bpw = window.getWindow();
1682         while (!XlibUtil.isToplevelWindow(bpw) && !XlibUtil.isXAWTToplevelWindow(bpw)) {
1683             bpw = XlibUtil.getParentWindow(bpw);
1684         }
1685         long tpw = transientForWindow.getWindow();
1686         XBaseWindow parent = transientForWindow;
1687         while (tpw != 0 && ((!XlibUtil.isToplevelWindow(tpw) &&
1688                 !XlibUtil.isXAWTToplevelWindow(tpw)) || !parent.isVisible())) {
1689             tpw = XlibUtil.getParentWindow(tpw);
1690             parent = XToolkit.windowToXWindow(tpw);
1691         }








1692         XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, tpw);
1693         window.curRealTransientFor = parent;
1694     }
1695 
1696     /*
1697      * This method does nothing if this window is not blocked by any modal dialog.
1698      * For modal blocked windows this method looks up for the nearest
1699      *  prevTransiendFor window that is in the same state (Normal/Iconified/Withdrawn)
1700      *  as this one and makes this window transient for it. The same operation is
1701      *  performed for nextTransientFor window.
1702      * Values of prevTransientFor and nextTransientFor fields are not changed.
1703      */
1704     void updateTransientFor() {
1705         int state = getWMState();
1706         XWindowPeer p = prevTransientFor;
1707         while ((p != null) && ((p.getWMState() != state) || (p.getScreenNumber() != getScreenNumber()))) {
1708             p = p.prevTransientFor;
1709         }
1710         if (p != null) {
1711             setToplevelTransientFor(this, p, false, false);


   1 /*
   2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1672             window.prevTransientFor = transientForWindow;
1673             transientForWindow.nextTransientFor = window;
1674         }
1675         if (!allStates && (window.getWMState() != transientForWindow.getWMState())) {
1676             return;
1677         }
1678         if (window.getScreenNumber() != transientForWindow.getScreenNumber()) {
1679             return;
1680         }
1681         long bpw = window.getWindow();
1682         while (!XlibUtil.isToplevelWindow(bpw) && !XlibUtil.isXAWTToplevelWindow(bpw)) {
1683             bpw = XlibUtil.getParentWindow(bpw);
1684         }
1685         long tpw = transientForWindow.getWindow();
1686         XBaseWindow parent = transientForWindow;
1687         while (tpw != 0 && ((!XlibUtil.isToplevelWindow(tpw) &&
1688                 !XlibUtil.isXAWTToplevelWindow(tpw)) || !parent.isVisible())) {
1689             tpw = XlibUtil.getParentWindow(tpw);
1690             parent = XToolkit.windowToXWindow(tpw);
1691         }
1692 
1693         if (parent instanceof XLightweightFramePeer) {
1694             XLightweightFramePeer peer = (XLightweightFramePeer) parent;
1695             long ownerWindowPtr = peer.getOverridenWindowHandle();
1696             if (ownerWindowPtr != 0) {
1697                 tpw = ownerWindowPtr;
1698             }
1699         }
1700         XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, tpw);
1701         window.curRealTransientFor = parent;
1702     }
1703 
1704     /*
1705      * This method does nothing if this window is not blocked by any modal dialog.
1706      * For modal blocked windows this method looks up for the nearest
1707      *  prevTransiendFor window that is in the same state (Normal/Iconified/Withdrawn)
1708      *  as this one and makes this window transient for it. The same operation is
1709      *  performed for nextTransientFor window.
1710      * Values of prevTransientFor and nextTransientFor fields are not changed.
1711      */
1712     void updateTransientFor() {
1713         int state = getWMState();
1714         XWindowPeer p = prevTransientFor;
1715         while ((p != null) && ((p.getWMState() != state) || (p.getScreenNumber() != getScreenNumber()))) {
1716             p = p.prevTransientFor;
1717         }
1718         if (p != null) {
1719             setToplevelTransientFor(this, p, false, false);


< prev index next >