@Override public final void componentShown(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentShown: "+s(e)); } layoutSurfaceLayerIfEnabled(isShowing); }
protected synchronized void invalidate() { if(DEBUG) { System.err.println(jawtStr()+".invalidate() - "+jawtComponentListener.toString()); if( isSurfaceLayerAttached() ) { System.err.println("OffscreenSurfaceLayer still attached: 0x"+Long.toHexString(offscreenSurfaceLayer)); } // Thread.dumpStack(); } invalidateNative(); jawt = null; isOffscreenLayerSurface = false; drawable= 0; drawable_old = 0; bounds = new Rectangle(); insets = new Insets(); hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; } protected abstract void invalidateNative();
/** * 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" ); }
@Override public final void hierarchyChanged(final HierarchyEvent e) { final boolean wasShowing = isShowing; isShowing = component.isShowing(); int action = 0; if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & e.getChangeFlags() ) ) { if( e.getChanged() != component && wasShowing != isShowing ) { // A parent component changed and caused a 'showing' state change, // propagate to offscreen-layer! layoutSurfaceLayerIfEnabled(isShowing); action = 1; } } if(DEBUG) { final java.awt.Component changed = e.getChanged(); final boolean displayable = changed.isDisplayable(); final boolean showing = changed.isShowing(); System.err.println(jawtStr()+".hierarchyChanged: action "+action+", displayable "+displayable+", showing [changed "+showing+", comp "+isShowing+"], "+s(e)); } } }
private String s(final ComponentEvent e) { return "visible[isShowing "+isShowing+"],"+Platform.getNewline()+ " ** COMP "+str(e.getComponent())+Platform.getNewline()+ " ** SOURCE "+str(e.getSource())+Platform.getNewline()+ " ** THIS "+str(component)+Platform.getNewline()+ " ** THREAD "+getThreadName(); } private String s(final HierarchyEvent e) {
@Override public void run() { if(DEBUG) { System.err.println(jawtStr()+".attach @ Thread "+getThreadName()+": "+JAWTComponentListener.this.toString()); } component.addComponentListener(JAWTComponentListener.this); component.addHierarchyListener(JAWTComponentListener.this); } } ); }
@Override public final String toString() { return "visible[isShowing "+isShowing+"],"+Platform.getNewline()+ " ** THIS "+str(component)+Platform.getNewline()+ " ** THREAD "+getThreadName(); }
@Override public final void componentHidden(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentHidden: "+s(e)); } layoutSurfaceLayerIfEnabled(isShowing); }
@Override public void run() { if(DEBUG) { System.err.println(jawtStr()+".detach @ Thread "+getThreadName()+": "+JAWTComponentListener.this.toString()); } component.removeComponentListener(JAWTComponentListener.this); component.removeHierarchyListener(JAWTComponentListener.this); } } ); }
@Override public final void componentMoved(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentMoved: "+s(e)); } layoutSurfaceLayerIfEnabled(isShowing); }
private String s(final HierarchyEvent e) { return "visible[isShowing "+isShowing+"], changeBits 0x"+Long.toHexString(e.getChangeFlags())+Platform.getNewline()+ " ** COMP "+str(e.getComponent())+Platform.getNewline()+ " ** SOURCE "+str(e.getSource())+Platform.getNewline()+ " ** CHANGED "+str(e.getChanged())+Platform.getNewline()+ " ** CHANGEDPARENT "+str(e.getChangedParent())+Platform.getNewline()+ " ** THIS "+str(component)+Platform.getNewline()+ " ** THREAD "+getThreadName(); } @Override
@Override public final void componentResized(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentResized: "+s(e)); } layoutSurfaceLayerIfEnabled(isShowing); }