Java Code Examples for sun.awt.X11GraphicsEnvironment#runningXinerama()
The following examples show how to use
sun.awt.X11GraphicsEnvironment#runningXinerama() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XlibUtil.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 2
Source File: XlibUtil.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 3
Source File: XlibUtil.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 4
Source File: XlibUtil.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 5
Source File: XlibUtil.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 6
Source File: XlibUtil.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 7
Source File: XlibUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 8
Source File: XlibUtil.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 9
Source File: XlibUtil.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 10
Source File: XlibUtil.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 11
Source File: XlibUtil.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 12
Source File: XlibUtil.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Xinerama-aware version of XlibWrapper.RootWindow method. */ public static long getRootWindow(int screenNumber) { XToolkit.awtLock(); try { X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) GraphicsEnvironment.getLocalGraphicsEnvironment(); if (x11ge.runningXinerama()) { // all the Xinerama windows share the same root window return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0); } else { return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber); } } finally { XToolkit.awtUnlock(); } }
Example 13
Source File: XWindowPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }
Example 14
Source File: XWindowPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }
Example 15
Source File: XWindowPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }
Example 16
Source File: XWindowPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }
Example 17
Source File: XWindowPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }
Example 18
Source File: XWindowPeer.java From hottub with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }
Example 19
Source File: XWindowPeer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }
Example 20
Source File: XWindowPeer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
static Vector<XWindowPeer> collectJavaToplevels() { Vector<XWindowPeer> javaToplevels = new Vector<XWindowPeer>(); Vector<Long> v = new Vector<Long>(); X11GraphicsEnvironment ge = (X11GraphicsEnvironment)GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (!ge.runningXinerama() && (gds.length > 1)) { for (GraphicsDevice gd : gds) { int screen = ((X11GraphicsDevice)gd).getScreen(); long rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); v.add(rootWindow); } } else { v.add(XToolkit.getDefaultRootWindow()); } final int windowsCount = windows.size(); while ((v.size() > 0) && (javaToplevels.size() < windowsCount)) { long win = v.remove(0); XQueryTree qt = new XQueryTree(win); try { if (qt.execute() != 0) { int nchildren = qt.get_nchildren(); long children = qt.get_children(); // XQueryTree returns window children ordered by z-order for (int i = 0; i < nchildren; i++) { long child = Native.getWindow(children, i); XBaseWindow childWindow = XToolkit.windowToXWindow(child); // filter out Java non-toplevels if ((childWindow != null) && !(childWindow instanceof XWindowPeer)) { continue; } else { v.add(child); } if (childWindow instanceof XWindowPeer) { XWindowPeer np = (XWindowPeer)childWindow; javaToplevels.add(np); // XQueryTree returns windows sorted by their z-order. However, // if WM has not handled transient for hint for a child window, // it may appear in javaToplevels before its owner. Move such // children after their owners. int k = 0; XWindowPeer toCheck = javaToplevels.get(k); while (toCheck != np) { XWindowPeer toCheckOwnerPeer = toCheck.getOwnerPeer(); if (toCheckOwnerPeer == np) { javaToplevels.remove(k); javaToplevels.add(toCheck); } else { k++; } toCheck = javaToplevels.get(k); } } } } } finally { qt.dispose(); } } return javaToplevels; }