@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+">"); } }
protected static int chooseCapabilities(CapabilitiesChooser chooser, final CapabilitiesImmutable capsRequested, final List<? extends CapabilitiesImmutable> availableCaps, final int recommendedIndex) { if (null == capsRequested) { throw new NativeWindowException("Null requested capabilities"); e.printStackTrace();
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); } }
/** * Wraps an AWT component into a {@link javax.media.nativewindow.NativeWindow} utilizing the {@link javax.media.nativewindow.NativeWindowFactory},<br> * using a configuration agnostic dummy {@link javax.media.nativewindow.DefaultGraphicsConfiguration}.<br> * <p> * The actual wrapping implementation is {@link com.jogamp.nativewindow.awt.JAWTWindow}.<br></p> * <p> * Purpose of this wrapping is to access the AWT window handle,<br> * not to actually render into it.<br> * Hence the dummy configuration only.</p> * * @param awtCompObject must be of type java.awt.Component */ public static JAWTWindow getNativeWindow(final Object awtCompObject, final CapabilitiesImmutable capsRequested) { if(null==awtCompObject) { throw new NativeWindowException("Null AWT Component"); } if( ! (awtCompObject instanceof java.awt.Component) ) { throw new NativeWindowException("AWT Component not a java.awt.Component"); } return getNativeWindow( (java.awt.Component) awtCompObject, capsRequested ); }
@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); } }
@Override public boolean open() { if(handleOwner && 0 == handle) { if(DEBUG) { System.err.println(Thread.currentThread().getName() + " - X11GraphicsDevice.open(): "+this); } handle = X11Util.openDisplay(connection); if(0 == handle) { throw new NativeWindowException("X11GraphicsDevice.open() failed: "+this); } return true; } return false; }
@Override final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: // fall through intended case X11_XVISUAL: return getXVisualID(); case X11_FBCONFIG: return VisualIDHolder.VID_UNDEFINED; default: throw new NativeWindowException("Invalid type <"+type+">"); } }
@Override final protected int lockSurfaceImpl() { if (0 == windowHandle) { throw new NativeWindowException("null window handle: "+this); } if (0 != surfaceHandle) { throw new InternalError("surface not released"); } surfaceHandle = GDI.GetDC(windowHandle); /* if(0 == surfaceHandle) { System.err.println("****** DC Acquire: 0x"+Long.toHexString(windowHandle)+", isWindow "+GDI.IsWindow(windowHandle)+", isVisible "+GDI.IsWindowVisible(windowHandle)+", GDI LastError: "+GDI.GetLastError()+", 0x"+Long.toHexString(surfaceHandle)+", GDI LastError: "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName()); Thread.dumpStack(); } */ return (0 != surfaceHandle) ? LOCK_SUCCESS : LOCK_SURFACE_NOT_READY; }
/** * Send mouse event (one-pointer) either to be directly consumed or to be enqueued * * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued}, * otherwise {@link #consumeEvent(NEWTEvent) consumed} directly. * @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}. */ protected void doMouseEvent(final boolean enqueue, final boolean wait, final short eventType, final int modifiers, final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) { if( 0 > button || button > MouseEvent.BUTTON_COUNT ) { throw new NativeWindowException("Invalid mouse button number" + button); } doPointerEvent(enqueue, wait, constMousePointerTypes, eventType, modifiers, 0 /*actionIdx*/, new short[] { (short)0 }, button, new int[]{x}, new int[]{y}, new float[]{0f} /*pressure*/, 1f /*maxPressure*/, rotationXYZ, rotationScale); }
/** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ public static synchronized void initSingleton() { if(!isInit) { if(DEBUG) { System.out.println("OSXUtil.initSingleton()"); } if(!NWJNILibLoader.loadNativeWindow("macosx")) { throw new NativeWindowException("NativeWindow MacOSX native library load error."); } if( !initIDs0() ) { throw new NativeWindowException("MacOSX: Could not initialized native stub"); } isInit = true; } }
/** * Opens the EGL device if handle is null and it's {@link EGLDisplayLifecycleCallback} is valid. * <p> * {@inheritDoc} * </p> */ @Override public boolean open() { if(null != eglLifecycleCallback && 0 == handle) { if(DEBUG) { System.err.println(Thread.currentThread().getName() + " - EGLGraphicsDevice.open(): "+this); } handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID); if(0 == handle) { throw new NativeWindowException("EGLGraphicsDevice.open() failed: "+this); } return true; } return false; }
throw new NativeWindowException(ex); h = swt_control_handle.getLong(swtControl); } catch (final Exception ex) { throw new NativeWindowException(ex); throw new NativeWindowException("Null widget-handle of SWT "+swtControl.getClass().getName()+": "+swtControl.toString());
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; }