protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { if (!(absScreen instanceof X11GraphicsScreen)) { throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here"); } if (!(capsChosen instanceof GLCapabilitiesImmutable)) { throw new IllegalArgumentException( "This NativeWindowFactory accepts only GLCapabilities objects - chosen"); } if (!(capsRequested instanceof GLCapabilitiesImmutable)) { throw new IllegalArgumentException( "This NativeWindowFactory accepts only GLCapabilities objects - requested"); } if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException( "This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } if (!GLXUtil.isGLXAvailableOnServer((X11GraphicsDevice) absScreen.getDevice())) { if (null != fallbackX11GraphicsConfigurationFactory) { if (DEBUG) { System.err.println( "No GLX available, fallback to " + fallbackX11GraphicsConfigurationFactory.getClass().getSimpleName() + " for: " + absScreen); } return fallbackX11GraphicsConfigurationFactory.chooseGraphicsConfiguration( capsChosen, capsRequested, chooser, absScreen); } throw new InternalError( "No GLX and no fallback GraphicsConfigurationFactory available for: " + absScreen); } return chooseGraphicsConfigurationStatic( (GLCapabilitiesImmutable) capsChosen, (GLCapabilitiesImmutable) capsRequested, (GLCapabilitiesChooser) chooser, (X11GraphicsScreen) absScreen); }
protected void createNativeImpl() { final ScreenDriver screen = (ScreenDriver) getScreen(); final DisplayDriver display = (DisplayDriver) screen.getDisplay(); final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice(); // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering final long renderDeviceHandle = X11Util.openDisplay(edtDevice.getConnection()); if (0 == renderDeviceHandle) { throw new RuntimeException("Error creating display(EDT): " + edtDevice.getConnection()); } renderDevice = new X11GraphicsDevice( renderDeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); final AbstractGraphicsScreen renderScreen = new X11GraphicsScreen(renderDevice, screen.getIndex()); final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(display.getGraphicsDevice(), capsRequested); final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, renderScreen, VisualIDHolder.VID_UNDEFINED); if (DEBUG_IMPLEMENTATION) { System.err.println( "X11Window.createNativeImpl() factory: " + factory + ", chosen config: " + cfg); } if (null == cfg) { throw new NativeWindowException( "Error choosing GraphicsConfiguration creating window: " + this); } final int visualID = cfg.getVisualID(VIDType.NATIVE); if (VisualIDHolder.VID_UNDEFINED == visualID) { throw new NativeWindowException("Chosen Configuration w/o native visual ID: " + cfg); } setGraphicsConfiguration(cfg); final int flags = getReconfigureFlags(0, true) & (FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED); edtDevice.lock(); try { setWindowHandle( CreateWindow0( getParentWindowHandle(), edtDevice.getHandle(), screen.getIndex(), visualID, display.getJavaObjectAtom(), display.getWindowDeleteAtom(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags)); } finally { edtDevice.unlock(); } windowHandleClose = getWindowHandle(); if (0 == windowHandleClose) { throw new NativeWindowException("Error creating window"); } }