/** * Returns <code>true</code> if this instance has valid {@link sun.awt.AppContext} information, * i.e. {@link #getCachedThreadGroup()} returns not <code>null</code>. */ public final boolean isValid() { return null != getCachedThreadGroup(); }
public AppContextInfo(final String info) { update(info); }
if( update("invoke") ) { t = Thread.currentThread(); if( DEBUG ) { System.err.println("Bug 1004: Invoke.0 on current AppContext thread: "+t+" "+toHexString(t.hashCode())); final ThreadGroup tg = getCachedThreadGroup(); final String tName = threadBaseName + ( null != tg ? "-OnAppContextTG" : "-OnSystemTG" ); t = RunnableTask.invokeOnNewThread(tg, waitUntilDone, runnable, tName); if( DEBUG ) { final int tgHash = null != tg ? tg.hashCode() : 0; System.err.println("Bug 1004: Invoke.1 on new AppContext thread: "+t+" "+toHexString(t.hashCode())+", tg "+tg+" "+toHexString(tgHash));
if ( null != getAppContextMethod ) { final Object thisThreadAppContext = fetchAppContext(); final boolean tgMapped = null != thisThreadAppContext; System.err.println("Bug 1004[TGMapped "+tgMapped+"]: Init AppContext @ "+info+" on thread "+thread.getName()+" "+toHexString(thread.hashCode())+ ": tg "+threadGroup.getName()+" "+toHexString(threadGroup.hashCode())+ " -> appCtx [ main "+mainThreadAppContext+" "+toHexString(mainThreadAppContextHash)+ " -> this "+thisThreadAppContext+" "+toHexString(thisThreadAppContextHash) + " ] "); final int mainThreadAppContextHash = mainThreadAppContext.hashCode(); final int thisThreadAppContextHash = thisThreadAppContext.hashCode(); System.err.println("Bug 1004[TGMapped "+tgMapped+"]: OK AppContext @ "+info+" on thread "+thread.getName()+" "+toHexString(thread.hashCode())+ ": tg "+threadGroup.getName()+" "+toHexString(threadGroup.hashCode())+ " : appCtx [ this "+thisThreadAppContext+" "+toHexString(thisThreadAppContextHash)+ " , main "+mainThreadAppContext+" "+toHexString(mainThreadAppContextHash) + " ] "); final int mainThreadAppContextHash = null != mainThreadAppContext ? mainThreadAppContext.hashCode() : 0; final int thisThreadAppContextHash = null != thisThreadAppContext ? thisThreadAppContext.hashCode() : 0; System.err.println("Bug 1004[TGMapped "+tgMapped+"]: No AppContext @ "+info+" on thread "+thread.getName()+" "+toHexString(thread.hashCode())+ ": tg "+threadGroup.getName()+" "+toHexString(threadGroup.hashCode())+ " -> appCtx [ this "+thisThreadAppContext+" "+toHexString(thisThreadAppContextHash)+ " -> main "+mainThreadAppContext+" "+toHexString(mainThreadAppContextHash) + " ] ");
@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() {
/** * Constructed by {@link jogamp.nativewindow.NativeWindowFactoryImpl#getNativeWindow(Object, AbstractGraphicsConfiguration)} * via this platform's specialization (X11, OSX, Windows, ..). * * @param comp * @param config */ protected JAWTWindow(final Object comp, final AbstractGraphicsConfiguration config) { if (config == null) { throw new NativeWindowException("Error: AbstractGraphicsConfiguration is null"); } if(! ( config instanceof AWTGraphicsConfiguration ) ) { throw new NativeWindowException("Error: AbstractGraphicsConfiguration is not an AWTGraphicsConfiguration: "+config); } appContextInfo = new AppContextInfo("<init>"); this.component = (Component)comp; this.config = (AWTGraphicsConfiguration) config; this.jawtComponentListener = new JAWTComponentListener(); invalidate(); this.isApplet = false; this.offscreenSurfaceLayer = 0; } private static String id(final Object obj) { return ( null!=obj ? toHexString(obj.hashCode()) : "nil" ); }