public void handleReparentNotify(XEvent xev) { XReparentEvent re = xev.get_xreparent(); long newParent = re.get_parent(); if (active) { // unregister accelerators, etc. for old parent embedded.notifyStopped(); // check if newParent is a root window X11GraphicsConfig gc = (X11GraphicsConfig)embedded.getGraphicsConfiguration(); X11GraphicsDevice gd = (X11GraphicsDevice)gc.getDevice(); if ((newParent == XlibUtil.getRootWindow(gd.getScreen())) || (newParent == XToolkit.getDefaultRootWindow())) { // reparenting to root means XEmbed termination active = false; } else { // continue XEmbed with a new parent server = newParent; embedded.notifyStarted(); } } }
public void handleReparentNotify(XEvent xev) { XReparentEvent re = xev.get_xreparent(); long newParent = re.get_parent(); if (active) { // unregister accelerators, etc. for old parent embedded.notifyStopped(); // check if newParent is a root window X11GraphicsConfig gc = (X11GraphicsConfig)embedded.getGraphicsConfiguration(); X11GraphicsDevice gd = gc.getDevice(); if ((newParent == XlibUtil.getRootWindow(gd.getScreen())) || (newParent == XToolkit.getDefaultRootWindow())) { // reparenting to root means XEmbed termination active = false; } else { // continue XEmbed with a new parent server = newParent; embedded.notifyStarted(); } } }
private GLXGraphicsConfig(X11GraphicsDevice device, int visualnum, long configInfo, ContextCapabilities oglCaps) { super(device, visualnum, 0, 0, (oglCaps.getCaps() & CAPS_DOUBLEBUFFERED) != 0); pConfigInfo = configInfo; initConfig(getAData(), configInfo); this.oglCaps = oglCaps; context = new OGLContext(OGLRenderQueue.getInstance(), this); }
public static GLXGraphicsConfig getConfig(X11GraphicsDevice device, int visualnum) { if (!X11GraphicsEnvironment.isGLXAvailable()) { return null; } long cfginfo = 0; final String ids[] = new String[1]; OGLRenderQueue rq = OGLRenderQueue.getInstance(); rq.lock(); try { // getGLXConfigInfo() creates and destroys temporary // surfaces/contexts, so we should first invalidate the current // Java-level context and flush the queue... OGLContext.invalidateCurrentContext(); GLXGetConfigInfo action = new GLXGetConfigInfo(device.getScreen(), visualnum); rq.flushAndInvokeNow(action); cfginfo = action.getConfigInfo(); if (cfginfo != 0L) { OGLContext.setScratchSurface(cfginfo); rq.flushAndInvokeNow(new Runnable() { public void run() { ids[0] = OGLContext.getOGLIdString(); } }); } } finally { rq.unlock(); } if (cfginfo == 0) { return null; } int oglCaps = getOGLCapabilities(cfginfo); ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]); return new GLXGraphicsConfig(device, visualnum, cfginfo, caps); }
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; }
@Override boolean isGraphicsConfigSupported(GraphicsConfigTemplate3D template, GraphicsConfiguration gc) { X11GraphicsDevice gd = (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice(); if (!X11NativeScreenInfo.isGLX13()) { return false; } long display = NativeScreenInfo.getNativeScreenInfo().getDisplay(); int screen = NativeScreenInfo.getNativeScreenInfo().getScreen(gd); int[] attrList; // holds the list of attributes to be tramslated // for glxChooseVisual call attrList = new int[NUM_ITEMS]; // assign template values to array attrList[RED_SIZE] = template.getRedSize(); attrList[GREEN_SIZE] = template.getGreenSize(); attrList[BLUE_SIZE] = template.getBlueSize(); attrList[DEPTH_SIZE] = template.getDepthSize(); attrList[DOUBLEBUFFER] = template.getDoubleBuffer(); attrList[STEREO] = template.getStereo(); attrList[ANTIALIASING] = template.getSceneAntialiasing(); attrList[STENCIL_SIZE] = template.getStencilSize(); // System.out.println("X11NativeConfigTemplate3D : getStencilSize " + // attrList[STENCIL_SIZE]); long[] fbConfig = new long[1]; int visID = chooseOglVisual(display, screen, attrList, fbConfig); if (visID == 0 || fbConfig[0] == 0) return false; // no valid visual was found else return true; }
@Override boolean hasStereo(Canvas3D c3d) { GraphicsConfiguration gc = c3d.graphicsConfiguration; X11GraphicsDevice gd = (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice(); long display = NativeScreenInfo.getNativeScreenInfo().getDisplay(); int screen = NativeScreenInfo.getNativeScreenInfo().getScreen(gd); int vid = ((X11GraphicsConfig)gc).getVisual(); return isStereoAvailable(display, screen, vid); }