Bug 937

Summary: JAWTWindow: Unsatisfying Visibility Computation (was: Canvas in CardLayout always visible)
Product: [JogAmp] Jogl Reporter: Gene <gene.ressler>
Component: macosxAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: critical CC: andres.colubri, fzanelli
Priority: ---    
Version: 2   
Hardware: pc_x86_64   
OS: macosx   
Type: --- SCM Refs:
071bdd6ce9f8c41ccecdbf8bc74f276ccd7ff651 d2f50f2ed523aa8443f647e46aeecc09fa27583d 9dcaf86ad6ae08e60c68abd4c069f3ab19807854 367b704b448b4ebabcfc62cc29e61fa5760514d1
Workaround: ---
Bug Depends on:    
Bug Blocks: 816, 849, 889, 906, 928    

Description Gene 2014-01-05 08:29:34 CET
Earlier bug 532 (https://jogamp.org/bugzilla/show_bug.cgi?id=532) now occurs in Mac OS X Lion and Mavericks.  

Once a GLCanvas overlays a lightweight Swing panel, it never can be reordered below it again.  This is a z-ordering problem.

The sample code in 532 has a CardLayout with a JPanel for the top card and GLCanvas for the bottom.  

Press the button and the GLCanvas with rotating square animation comes to top.  Press it again, and the JPanel should come back.  

It does on 32- and 64-bit Windows platforms with JRE 6 and 7.  Not with Mac under JRE 7.
Comment 1 Sven Gothel 2014-01-05 18:33:15 CET
Can you reproduce with the derived unit test ?
  com.jogamp.opengl.test.junit.jogl.acore.anim.TestAWTCardLayoutAnimatorStartStopBug532

I double check w/ latest tip ..
Comment 3 Sven Gothel 2014-01-10 16:06:45 CET
Tested 'TestAWTCardLayoutAnimatorStartStopBug532' on OSX 10.9 (CALayer) ..

Experience:

1- LABEL: Shows
2- Switch to GLCanvas
3- GLCanvas shows 
4- Switch to LABEL
5- LABEL Shows
6- Switch to GLCanvas
7- Nothing Shows  ** BUG **

Can you confirm that the above is the issue at hand ?
Comment 4 Sven Gothel 2014-01-10 16:09:42 CET
(In reply to comment #3)
> Tested 'TestAWTCardLayoutAnimatorStartStopBug532' on OSX 10.9 (CALayer) ..
...

Note - I also tested the following manually without any issue on OSX and X11:

# Simple GLCanvas setVisible on/off
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug664GLCanvasSetVisibleSwingAWT $*

#
# GLCanvas moving between JTabbedPanel's tabs
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT $*

#
# GLCanvas/AWT Checkbox Visibility
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03aB729AWT $*

#
# GLCanvas/AWT Checkbox Visibility (on parent's Panel)
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bB849AWT $*
#
# GLCanvas/Swing Checkbox Visibility (on parent's JPanel)
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cB849AWT $*
Comment 5 Sven Gothel 2014-01-12 08:17:55 CET
071bdd6ce9f8c41ccecdbf8bc74f276ccd7ff651
    
    Simplify JAWTComponentListener's HierarchyListener:
      - Don't interfere w/ Component's visibility anymore!
        This shall reduce sideeffects.
        Utilize 'isShowing' in each Component specialization, i.e. GLCanvas.
    
      - On SHOWING_CHANGED if a parent caused a change
        of the tracked components showing state,
        propagate it to the offscreen-layer!
    
      - Remove all other complicated states!
    
    GLCanvas, GLJPanel:
      - Instead of 'isVisible()' use 'showing state',
        since only the 'showing state' reflects 'true' visibility
        throughout the hierarchy.
    
      - Add HierarchyListener and track volatile showing state
        to be used instead of 'isVisible'.
        Using a cached showing state is more efficient
        than quering 'isShowing()' all the time!
    
    NewtCanvasAWT:
      - Use 'isShowing()' instead of 'isVisible(), see above

d2f50f2ed523aa8443f647e46aeecc09fa27583d
     AWTParentWindowAdapter/AWTRobotUtil: Use 'isShowing()' instead of 'isVisible()' 
     determining actual on-screen showing state
Comment 6 Sven Gothel 2014-01-12 08:18:57 CET
Manually tested:


#
# Simple GLCanvas setVisible on/off
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug664GLCanvasSetVisibleSwingAWT $*

#
# GLCanvas moving between CardLayout's JPanels
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.acore.anim.TestAWTCardLayoutAnimatorStartStopBug532 $*

#
# GLCanvas moving between JTabbedPanel's tabs
#   OK (X11, OSX)
testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT $*

#
# GLCanvas/AWT Checkbox Visibility
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03aB729AWT $*

#
# GLCanvas/AWT Checkbox Visibility (on parent's Panel)
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bB849AWT $*
#
# GLCanvas/Swing Checkbox Visibility (on parent's JPanel)
#   OK (X11, OSX)
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cB849AWT $*

#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816GLCanvasFrameHoppingB849B889AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04aAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT $*
Comment 7 Sven Gothel 2014-01-21 19:38:49 CET
9dcaf86ad6ae08e60c68abd4c069f3ab19807854
   JAWTWindow.JAWTComponentListener: Minor Cleanup


367b704b448b4ebabcfc62cc29e61fa5760514d1
  OSXMisc CALayer::FixCALayerLayout: Fix visible:=false case, i.e. don'r override cached visibleOpacity w/ forced zero when called twice
Comment 8 Sven Gothel 2014-01-21 19:39:56 CET
*** Bug 946 has been marked as a duplicate of this bug. ***