aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-06 02:28:14 +0200
committerSven Gothel <[email protected]>2013-10-06 02:28:14 +0200
commitff86d8398ce66abddff4cbada8eabd1314a11d7b (patch)
tree12c1b11a85750caef762abefc60c02fae1623679
parentae103ba597464ca25071950af7afe012e2b86c13 (diff)
Bug 729: OSX CALayer invisible needs to have opacity 0 to not show hidden component.
Completes commit 3b02a219b1b9e446e87df1beb7da4266f74824fa See unit test: TestBug816OSXCALayerPos03AWT
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.m13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03AWT.java5
3 files changed, 14 insertions, 8 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 2789c9ea1..f3b535058 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -456,9 +456,9 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
#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.TestBug816OSXCALayerPos03AWT $*
+testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04aAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index 889e1efd3..3b19440d7 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -336,6 +336,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
@private
BOOL fixedFrameSet;
CGRect fixedFrame;
+ float visibleOpacity;
}
- (id)init;
#ifdef DBG_LIFECYCLE
@@ -358,6 +359,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
MyCALayer * o = [super init];
o->fixedFrameSet = 0;
o->fixedFrame = CGRectMake(0, 0, 0, 0);
+ o->visibleOpacity = 1.0;
DBG_PRINT("MyCALayer::init.X: new %p\n", o);
return o;
}
@@ -457,16 +459,17 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
CGRect superFrame = [superLayer frame];
CGRect lFrame = [self frame];
if( visible ) {
- // Setting opacity should not be required, otherwise we should save the opacity value.
- // [subLayer setOpacity: 1.0];
- // [self setOpacity: 1.0];
+ // Opacity must be 0 to see through the disabled CALayer
+ [subLayer setOpacity: visibleOpacity];
+ [self setOpacity: visibleOpacity];
[self setHidden: NO];
[subLayer setHidden: NO];
} else {
[subLayer setHidden: YES];
[self setHidden: YES];
- // [subLayer setOpacity: 0.0];
- // [self setOpacity: 0.0];
+ visibleOpacity = [self opacity];
+ [subLayer setOpacity: 0.0];
+ [self setOpacity: 0.0];
}
int posQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_POSITION & caLayerQuirks ) && ( lFrame.origin.x!=0 || lFrame.origin.y!=0 );
int sizeQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_SIZE & caLayerQuirks ) && ( lFrame.size.width!=width || lFrame.size.height!=height );
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03AWT.java
index 6589cac1e..92d24e417 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03AWT.java
@@ -86,7 +86,10 @@ public class TestBug816OSXCALayerPos03AWT extends UITestCase {
checkbox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ev) {
glCanvas1.setVisible(checkbox.getState());
- System.out.println(glCanvas1.isVisible());
+ System.out.println("Canvas visible: "+glCanvas1.isVisible());
+ if( glCanvas1.isVisible() ) {
+ frame.validate(); // take care of resized frame while hidden
+ }
}
});