diff options
author | Sven Gothel <[email protected]> | 2013-10-31 04:34:28 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-31 04:34:28 +0100 |
commit | 887dbdb34d71a3a266b7854bc9a3842aad1032f9 (patch) | |
tree | aa46825c7e9a7acac338473f0cea622b93a32dea /src/nativewindow/classes | |
parent | 24485ead77a368ae3b77108248e067ad1f44ef0a (diff) |
Fix Bug 878 - JAWTWindow's HierarchyListener doesn't set component visible (again) on 'addNotify(..)' - GLCanvas in JtabbedPane disappear
Regression of commit e33e6374e0be0454f7e9732b5f897f84dbc3c4dc (Fix for Bug 729 and Bug 849) !
+++
JAWTWindow's HierarchyListener doesn't set component visible (again) on 'addNotify(..)'
It only renders the component invisible after removeNotify() which is performed implicit anyways ..
Case java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED
shall perform similar as our java.awt.event.HierarchyEvent.SHOWING_CHANGED impl.
+++
Tested on Gnu/Linux X11 and OSX incl. re-test Bug 729 and Bug 849 unit tests.
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 49b2daeae..a99737613 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -124,18 +124,20 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, private boolean globalVisibility = localVisibility; private boolean visibilityPropagation = false; + private String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); } + private String s(ComponentEvent e) { return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"],"+Platform.getNewline()+ - " ** COMP "+e.getComponent()+Platform.getNewline()+ - " ** SOURCE "+e.getSource()+Platform.getNewline()+ + " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+ + " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+ " ** THIS "+component; } private String s(HierarchyEvent e) { return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"], changeBits 0x"+Long.toHexString(e.getChangeFlags())+Platform.getNewline()+ - " ** COMP "+e.getComponent()+Platform.getNewline()+ - " ** SOURCE "+e.getSource()+Platform.getNewline()+ - " ** CHANGED "+e.getChanged()+Platform.getNewline()+ - " ** CHANGEDPARENT "+e.getChangedParent()+Platform.getNewline()+ + " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+ + " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+ + " ** CHANGED "+id(e.getChanged())+": "+e.getChanged()+Platform.getNewline()+ + " ** CHANGEDPARENT "+id(e.getChangedParent())+": "+e.getChangedParent()+Platform.getNewline()+ " ** THIS "+component; } @@ -177,14 +179,16 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, final java.awt.Component changed = e.getChanged(); if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) { final boolean displayable = changed.isDisplayable(); - final boolean resetLocalVisibility = changed == component && !displayable && localVisibility != component.isVisible(); - if( resetLocalVisibility ) { - // Reset components local state if detached from parent, i.e. 'removeNotify()' + final boolean propagateDisplayability = changed == component && ( displayable && localVisibility ) != component.isVisible(); + if( propagateDisplayability ) { + // Propagate parent's displayability, i.e. 'removeNotify()' and 'addNotify()' + final boolean _visible = displayable && localVisibility; visibilityPropagation = true; + globalVisibility = displayable; if(DEBUG) { - System.err.println("JAWTWindow.hierarchyChanged DISPLAYABILITY_CHANGED (1): displayable "+displayable+", "+s(e)); + System.err.println("JAWTWindow.hierarchyChanged DISPLAYABILITY_CHANGED (1): displayable "+displayable+" -> visible "+_visible+", "+s(e)); } - component.setVisible(localVisibility); + component.setVisible(_visible); } else if(DEBUG) { System.err.println("JAWTWindow.hierarchyChanged DISPLAYABILITY_CHANGED (x): displayable "+displayable+", "+s(e)); } |