@Override public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: return VisualIDHolder.VID_UNDEFINED; default: throw new NativeWindowException("Invalid type <"+type+">"); } }
public AWTCanvas(final CapabilitiesImmutable capabilities, final CapabilitiesChooser chooser, final UpstreamScalable upstreamScale) { super(); if(null==capabilities) { throw new NativeWindowException("Capabilities null"); } this.capabilities=capabilities; this.chooser=chooser; this.upstreamScale = upstreamScale; }
public static WindowClosingProtocol.WindowClosingMode AWT2NWClosingOperation(final int awtClosingOperation) { switch (awtClosingOperation) { case WindowConstants.DISPOSE_ON_CLOSE: case WindowConstants.EXIT_ON_CLOSE: return WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE; case WindowConstants.DO_NOTHING_ON_CLOSE: case WindowConstants.HIDE_ON_CLOSE: return WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE; default: throw new NativeWindowException("Unhandled AWT Closing Operation: " + awtClosingOperation); } }
@Override protected void invalidateImpl() { if(0 != surfaceHandle) { throw new NativeWindowException("didn't release surface Handle: "+this); } windowHandle = 0; // surfaceHandle = 0; }
@Override public Object clone() { try { return super.clone(); } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } }
@Override public Object clone() { try { return super.clone(); } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } }
@Override public Object clone() { try { return super.clone(); } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } }
@Override public Object clone() { try { return super.clone(); } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } }
@Override final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: case WIN32_PFD: return getPFDID(); default: throw new NativeWindowException("Invalid type <"+type+">"); } }
@Override public Object clone() { try { return super.clone(); } catch (final RuntimeException e) { throw new NativeWindowException(e); } }
public static JAWTWindow getNativeWindow(final java.awt.Component awtComp, final CapabilitiesImmutable capsRequested) { final AWTGraphicsConfiguration config = AWTGraphicsConfiguration.create(awtComp, null, capsRequested); final NativeWindow nw = NativeWindowFactory.getNativeWindow(awtComp, config); // a JAWTWindow if(! ( nw instanceof JAWTWindow ) ) { throw new NativeWindowException("Not an AWT NativeWindow: "+nw); } if(DEBUG_IMPLEMENTATION) { System.err.println("NewtFactoryAWT.getNativeWindow: "+awtComp+" -> "+nw); } return (JAWTWindow)nw; }
@Override public final void detachSurfaceLayer() throws NativeWindowException { if( 0 == offscreenSurfaceLayer) { throw new NativeWindowException("No offscreen layer attached: "+this); } if(DEBUG) { System.err.println("JAWTWindow.detachSurfaceHandle(): osh "+toHexString(offscreenSurfaceLayer)); } detachSurfaceLayerImpl(offscreenSurfaceLayer, detachSurfaceLayerNotify); } private final Runnable detachSurfaceLayerNotify = new Runnable() {
@Override final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case EGL_CONFIG: return getEGLConfigID(); case NATIVE: return getNativeVisualID(); default: throw new NativeWindowException("Invalid type <"+type+">"); } }
@Override final protected void unlockSurfaceImpl() { if (0 != surfaceHandle) { if(0 == GDI.ReleaseDC(windowHandle, surfaceHandle)) { throw new NativeWindowException("DC not released: "+this+", isWindow "+GDI.IsWindow(windowHandle)+", werr "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName()); } surfaceHandle=0; } }
public static long gdk_window_get_xwindow(final long window) { final long xWindow; if (OS_gtk_version.compareTo(GTK_VERSION_3_0_0) >= 0) { xWindow = callStaticMethodL2L(OS_gdk_x11_window_get_xid, window); } else { xWindow = callStaticMethodL2L(OS_gdk_x11_drawable_get_xid, window); } if(0 == xWindow) { throw new NativeWindowException("Null x11-window-handle of gtk-window-handle 0x"+Long.toHexString(window)); } return xWindow; }
public static long gdk_widget_get_window(final long handle) { final long window; if (OS_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) { window = callStaticMethodL2L(OS_gtk_widget_get_window, handle); } else { window = callStaticMethodL2L(OS_GTK_WIDGET_WINDOW, handle); } if(0 == window) { throw new NativeWindowException("Null gtk-window-handle of SWT handle 0x"+Long.toHexString(handle)); } return window; }
public int getDefaultVisualID() { final long display = getHandle(); if(0==display) { throw new NativeWindowException("null display"); } return X11Lib.DefaultVisualID(display, getDefaultScreenImpl(display)); }
@Override public final void attachSurfaceLayer(final long layerHandle) throws NativeWindowException { if( !isOffscreenLayerSurfaceEnabled() ) { throw new NativeWindowException("Not an offscreen layer surface"); } attachSurfaceLayerImpl(layerHandle); offscreenSurfaceLayer = layerHandle; appContextInfo.invokeOnAppContextThread(false /* waitUntilDone */, repaintTask, "Repaint"); } private final Runnable repaintTask = new Runnable() {
public static AbstractGraphicsScreen createScreenDevice(final long display, final int screenIdx, final boolean owner) { if(0==display) throw new NativeWindowException("display is null"); return new X11GraphicsScreen(new X11GraphicsDevice(display, AbstractGraphicsDevice.DEFAULT_UNIT, owner), screenIdx); }
@Override protected void createNativeImpl() { final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED); if (null == cfg) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } setGraphicsConfiguration(cfg); reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); if (0 == getWindowHandle()) { throw new NativeWindowException("Error creating window"); } }