From 166e5da5298b16b0acbf900004964d370cd0aa29 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 18 Dec 2013 21:59:39 +0100 Subject: Bug 928 - JAWTWindow's JAWTComponentListener _not_ attached and original visibility state not restored @ detach Commit ebed9f0322e2a2279a525e04ee3875c9034a7f45 (fix for Bug 906) causes a regression to fix for Bug 816, Bug 849 and Bug 889 (OSX CALayer Positioning and JAWTWindow visibility). The commit adds the JAWTComponentListener instance 'jawtComponentListener' to the component before it's assignment (duh!). +++ Further more, detaching the JAWTComponentListener shall restore the component's original 'local visibility state', which might got overridden by it's 'hierarchyChanged' implementation. +++ --- .../com/jogamp/nativewindow/awt/JAWTWindow.java | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/nativewindow/classes') diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 9a19a7f7a..3c660b41b 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -159,20 +159,21 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, " ** THREAD "+getThreadName(); } - public JAWTComponentListener() { + private JAWTComponentListener() { if(DEBUG) { - System.err.println(jawtStr()+".attach: "+toString()); + System.err.println(jawtStr()+".attach @ Thread "+getThreadName()+": "+toString()); } - component.addComponentListener(jawtComponentListener); - component.addHierarchyListener(jawtComponentListener); + component.addComponentListener(this); + component.addHierarchyListener(this); } - public final void detach() { + private final void detach() { if(DEBUG) { - System.err.println(jawtStr()+".detach: "+toString()); + System.err.println(jawtStr()+".detach @ Thread "+getThreadName()+": "+toString()); } - component.removeComponentListener(jawtComponentListener); - component.removeHierarchyListener(jawtComponentListener); + component.removeComponentListener(this); + component.removeHierarchyListener(this); + component.setVisible(localVisibility); // restore component's original local state } @Override @@ -251,6 +252,11 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } else if(DEBUG) { System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (x): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e)); } + } else if(DEBUG) { + final boolean displayable = changed.isDisplayable(); + final boolean _visible = displayable && localVisibility; + final boolean showing = changed.isShowing(); + System.err.println(jawtStr()+".hierarchyChanged OTHER: displayable "+displayable+", showing "+showing+" -> visible "+_visible+", "+s(e)); } } } -- cgit v1.2.3