diff options
author | Sven Gothel <[email protected]> | 2013-10-05 13:44:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-05 13:44:43 +0200 |
commit | 3b02a219b1b9e446e87df1beb7da4266f74824fa (patch) | |
tree | 3d8f55bbaeb8deeb666fd7735141f5f6afbbe68e /src/nativewindow/classes/com/jogamp | |
parent | 61e47c5683ef038d8684bce56714ae0a514dd697 (diff) |
Bug 729: OSX CALayer shall honor the Component's visibility state
A once visible CALayer (GLCanvas) must be able to become invisible w/o destruction,
e.g. as required by CardLayout's switching cards.
See unit test for Bug 532: 'TestAWTCardLayoutAnimatorStartStopBug532'
Out native 'fixCALayerLayout(..)' takes the visible state as tracked by JAWTWindow's ComponentListener
and sets our CALayer (root and sub) hidden state accordingly.
Now MacOSXJAWTWindow's layoutSurfaceLayerImpl(..) always calls down to 'fixCALayerLayout(..)'
due to update the visibility state.
Diffstat (limited to 'src/nativewindow/classes/com/jogamp')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 53eb985b2..d9f36901b 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -115,23 +115,28 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, this.isApplet = false; this.offscreenSurfaceLayer = 0; this.component.addComponentListener(new ComponentListener() { + private boolean visible = component.isVisible(); @Override public void componentResized(ComponentEvent e) { - layoutSurfaceLayerIfEnabled(); + layoutSurfaceLayerIfEnabled(visible); } @Override public void componentMoved(ComponentEvent e) { - layoutSurfaceLayerIfEnabled(); + layoutSurfaceLayerIfEnabled(visible); } @Override public void componentShown(ComponentEvent e) { - layoutSurfaceLayerIfEnabled(); + visible = true; + layoutSurfaceLayerIfEnabled(visible); } @Override - public void componentHidden(ComponentEvent e) { } + public void componentHidden(ComponentEvent e) { + visible = false; + layoutSurfaceLayerIfEnabled(visible); + } }); } @@ -247,14 +252,14 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * Call this method if any parent or ancestor's layout has been changed, * which could affects the layout of this surface. * </p> - * @see #isOffscreenLayerSurfaceEnabled() + * @see #isOffscreenLayerSurfaceEnabled() * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false */ - protected void layoutSurfaceLayerImpl(long layerHandle) {} + protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) {} - private final void layoutSurfaceLayerIfEnabled() throws NativeWindowException { + private final void layoutSurfaceLayerIfEnabled(boolean visible) throws NativeWindowException { if( isOffscreenLayerSurfaceEnabled() && 0 != offscreenSurfaceLayer ) { - layoutSurfaceLayerImpl(offscreenSurfaceLayer); + layoutSurfaceLayerImpl(offscreenSurfaceLayer, visible); } } |