Bug 729

Summary: OSX CALayer shall honor the Component's visibility state (was: Could not make OSX CALayer'ed GLCanvas invisible via CardLayout switching cards)
Product: [JogAmp] Jogl Reporter: leedingham
Component: macosxAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: critical CC: marcomoeller
Priority: P5    
Version: 2   
Hardware: pc_x86_64   
OS: macosx   
Type: --- SCM Refs:
3b02a219b1b9e446e87df1beb7da4266f74824fa ff86d8398ce66abddff4cbada8eabd1314a11d7b
Workaround: ---
Bug Depends on: 849    
Bug Blocks: 889, 906    
Attachments: Source Code to Demonstrate Bug

Description leedingham 2013-05-07 00:03:52 CEST
Created attachment 460 [details]
Source Code to Demonstrate Bug

Overview:

When using a CardLayout LayoutManager to switch between a
swing component and a GLCanvas, once the GLCanvas has been
displayed it remains visible after being switched out.

Edge artifacts of the red square while resizing the frame
when switched out shows that the GLCanvas bitmap is being
rescaled and redrawn rather than it's display method
being invoked.

This was not a problem with JOGL 1.1.1.

Steps to Reproduce: (See attachment for code sample)
1) Create a JPanel using a CardLayout. Add two cards, a JLabel and a GLCanvas.
2) Switch from the JLabel card to the GLCanvas card and back to the JLabel card.

Actual Results:
The GLCanvas does not disappear after switching back to the JLabel.

Expected Results:
The GLCaanvas should dissappear and the JLabel should reappear.

Build Date and Platform:
JOGL2 rc11, confirmed to still exist in:
Implementation Version: 2.0.2-rc-20130426
Platform: Mac OS X 10.8.3

Additional Builds and Platforms:
Have only tested JOGL 2 on Mac but problem did not occur in JOGL 1.x on Mac or Windows.
Comment 1 Sven Gothel 2013-05-07 01:23:24 CEST
Thank you for your detailed bug report, incl. the test case!

Just for your info - this is _not_ a regression!

JOGL1 had not code path to work w/ OSX >= 10.8.
Mentioned code path is new and completely different in JOGL2,
since it utilizes the new CALayer impl. which is the only supported path for Java7/OSX.
Further more, Java7's AWT itself is new.

Lightweight/Heavyweight mixing .. and 'complicated' AWT/Java2D UIs are especially 
difficult to achieve w/o bugs on OSX/Java7.
You may try to use GLJPanel as a last resort.

However, I will validate your test case - ofc - and see what is possible.
Comment 2 Sven Gothel 2013-05-09 02:23:49 CEST
You might want to try GLJPanel .. ? Will check on this at a later time.
Comment 3 Marco Möller 2013-08-05 11:34:48 CEST
Hi,

for me it would be crucial to get this bug fixed somehow... I am using Nasa World Wind, and all my MacOS clients are now waiting for some months to get the newest upgrade... recently my old version is not running anymore due to MacOS changes... so it would be great if you cold sove this.

Anyway: GREAT JOB GUYS!!

THX
-Marco
Comment 4 Sven Gothel 2013-10-05 13:46:33 CEST
    
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.
Comment 5 Sven Gothel 2013-10-06 02:30:27 CEST
OSX CALayer invisible needs to have opacity 0 to not show hidden component.

Completes commit 3b02a219b1b9e446e87df1beb7da4266f74824fa
    
See unit test: TestBug816OSXCALayerPos03AWT