aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-24 23:13:16 +0200
committerSven Gothel <[email protected]>2013-09-24 23:13:16 +0200
commit4b5435c68c3f12d62dadb395957362eceacfb25c (patch)
tree367ffa26e9a1119ac0ca5fe74eb8a96b367f6d68 /src/nativewindow
parent2f09d266f75dfb4ab0d4504dd0a7699757bc40b3 (diff)
Bug 816: Fix OSX CALayer 'quirks' for AWT 1.7.0_40 - See JAWTUtil JAWT_OSX_CALAYER_QUIRK_SIZE and JAWT_OSX_CALAYER_QUIRK_POSITION.
- Provide quirk bits for OSX CALayer depending on used JVM/AWT and act accordingly. - TestBug816OSXCALayerPosAWT: Add resize by frame
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java76
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java14
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java26
-rw-r--r--src/nativewindow/native/macosx/NativeWindowProtocols.h21
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.m143
5 files changed, 205 insertions, 75 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
index 1f5d33746..b663f90b7 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
@@ -68,7 +68,7 @@ public class JAWTUtil {
public static final VersionNumber JAWT_MacOSXCALayerMinVersion = new VersionNumber(10,6,4);
/** OSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7 */
- public static final VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersion = new VersionNumber(1,7,0);
+ public static final VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersion = Platform.Version17;
// See whether we're running in headless mode
private static final boolean headlessMode;
@@ -98,18 +98,84 @@ public class JAWTUtil {
* Returns true if this platform's JAWT implementation supports offscreen layer.
*/
public static boolean isOffscreenLayerSupported() {
- return Platform.OS_TYPE == Platform.OSType.MACOS &&
- Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0;
+ return Platform.OS_TYPE == Platform.OSType.MACOS &&
+ Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0;
}
/**
* Returns true if this platform's JAWT implementation requires using offscreen layer.
*/
public static boolean isOffscreenLayerRequired() {
- return Platform.OS_TYPE == Platform.OSType.MACOS &&
- Platform.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0;
+ return Platform.OS_TYPE == Platform.OSType.MACOS &&
+ Platform.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0;
}
+ /**
+ * CALayer size needs to be set using the AWT component size.
+ * <p>
+ * As of today, we have to overwrite the CALayer size
+ * w/ the AWT component one since programmatic resize leads to differences.
+ * </p>
+ * <p>
+ * Hence this flag is always enabled.
+ * </p>
+ * <p>
+ * Sync w/ NativeWindowProtocols.h
+ * </p>
+ */
+ public static final int JAWT_OSX_CALAYER_QUIRK_SIZE = 1 << 0;
+
+ /**
+ * CALayer position needs to be set to zero.
+ * <p>
+ * Normally we have to set the root-calayer's position to 0/0
+ * and leave client-calayer's position in it's desired place.
+ * With pre AWT 1.7.0_40, the client-calayer's position has to
+ * be set to zero as well.
+ * </p>
+ * <p>
+ * Further more a re-layout seems to be required in this case,
+ * i.e. a programmatic forced resize +1 and it's inverted resize -1.
+ * </p>
+ * <p>
+ * Hence this flag is enabled w/ AWT < 1.7.0_40.
+ * </p>
+ * <p>
+ * Sync w/ NativeWindowProtocols.h
+ * </p>
+ */
+ public static final int JAWT_OSX_CALAYER_QUIRK_POSITION = 1 << 1;
+
+ /**
+ * Returns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl. bugs.
+ * <p>
+ * Returns zero, if platform is not {@link Platform.OSType#MACOS}
+ * or not supporting CALayer, i.e. OSX < 10.6.4.
+ * </p>
+ * <p>
+ * Otherwise includes
+ * <ul>
+ * <li>{@link #JAWT_OSX_CALAYER_QUIRK_SIZE} (always)</li>
+ * <li>{@link #JAWT_OSX_CALAYER_QUIRK_POSITION} if JVM < 1.7.0_40</li>
+ * </ul>
+ * </p>
+ */
+ public static int getOSXCALayerQuirks() {
+ int res = 0;
+ if( Platform.OS_TYPE == Platform.OSType.MACOS &&
+ Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0 ) {
+
+ /** Knowing impl. all expose the SIZE bug */
+ res |= JAWT_OSX_CALAYER_QUIRK_SIZE;
+
+ final int c = Platform.JAVA_VERSION_NUMBER.compareTo(Platform.Version17);
+ if( c < 0 || c == 0 && Platform.JAVA_VERSION_UPDATE < 40 ) {
+ res |= JAWT_OSX_CALAYER_QUIRK_POSITION;
+ }
+ }
+ return res;
+ }
+
/**
* @param useOffscreenLayerIfAvailable
* @return
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
index 080504a5c..666f895f4 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
@@ -49,6 +49,7 @@ import javax.media.nativewindow.Capabilities;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.MutableSurface;
+import javax.media.nativewindow.NativeWindowFactory;
import javax.media.nativewindow.util.Point;
import com.jogamp.nativewindow.awt.JAWTWindow;
@@ -105,16 +106,19 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
protected void attachSurfaceLayerImpl(final long layerHandle) {
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
- OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, getWidth(), getHeight());
+ OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, getWidth(), getHeight(), JAWTUtil.getOSXCALayerQuirks());
} } );
}
@Override
protected void layoutSurfaceLayerImpl(long layerHandle, int width, int height) {
- if(DEBUG) {
- System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", "+width+"x"+height+"; "+this);
+ final int caLayerQuirks = JAWTUtil.getOSXCALayerQuirks();
+ if( 0 != caLayerQuirks ) {
+ if(DEBUG) {
+ System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", "+width+"x"+height+", caLayerQuirks "+caLayerQuirks+"; "+this);
+ }
+ OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, width, height, caLayerQuirks);
}
- OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, width, height);
}
@Override
@@ -240,7 +244,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
public void run() {
String errMsg = null;
if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) {
- rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
+ rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getWidth(), bounds.getHeight());
if(0 == rootSurfaceLayer) {
errMsg = "Could not create root CALayer";
} else {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index 1a90c095d..de24a76db 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -141,8 +141,8 @@ public class OSXUtil implements ToolkitProperties {
* @see #DestroyCALayer(long)
* @see #AddCASublayer(long, long)
*/
- public static long CreateCALayer(final int x, final int y, final int width, final int height) {
- final long l = CreateCALayer0(x, y, width, height);
+ public static long CreateCALayer(final int width, final int height) {
+ final long l = CreateCALayer0(width, height);
if(DEBUG) {
System.err.println("OSXUtil.CreateCALayer: 0x"+Long.toHexString(l)+" - "+Thread.currentThread().getName());
}
@@ -159,17 +159,18 @@ public class OSXUtil implements ToolkitProperties {
* Hence it is important that related resources are not locked <i>if</i>
* they will be used for creation.
* </p>
- * @see #CreateCALayer(int, int, int, int)
+ * @param caLayerQuirks TODO
+ * @see #CreateCALayer(int, int)
* @see #RemoveCASublayer(long, long, boolean)
*/
- public static void AddCASublayer(final long rootCALayer, final long subCALayer, final int width, final int height) {
+ public static void AddCASublayer(final long rootCALayer, final long subCALayer, final int width, final int height, final int caLayerQuirks) {
if(0==rootCALayer || 0==subCALayer) {
throw new IllegalArgumentException("rootCALayer 0x"+Long.toHexString(rootCALayer)+", subCALayer 0x"+Long.toHexString(subCALayer));
}
if(DEBUG) {
- System.err.println("OSXUtil.AttachCALayer: 0x"+Long.toHexString(subCALayer)+" - "+Thread.currentThread().getName());
+ System.err.println("OSXUtil.AttachCALayer: caLayerQuirks "+caLayerQuirks+", 0x"+Long.toHexString(subCALayer)+" - "+Thread.currentThread().getName());
}
- AddCASublayer0(rootCALayer, subCALayer, width, height);
+ AddCASublayer0(rootCALayer, subCALayer, width, height, caLayerQuirks);
}
/**
@@ -187,12 +188,13 @@ public class OSXUtil implements ToolkitProperties {
* @param subCALayer the client surface layer, maybe null.
* @param width the expected width
* @param height the expected height
+ * @param caLayerQuirks TODO
*/
- public static void FixCALayerLayout(final long rootCALayer, final long subCALayer, final int width, final int height) {
+ public static void FixCALayerLayout(final long rootCALayer, final long subCALayer, final int width, final int height, final int caLayerQuirks) {
if( 0==rootCALayer && 0==subCALayer ) {
return;
}
- FixCALayerLayout0(rootCALayer, subCALayer, width, height);
+ FixCALayerLayout0(rootCALayer, subCALayer, width, height, caLayerQuirks);
}
/**
@@ -210,7 +212,7 @@ public class OSXUtil implements ToolkitProperties {
/**
* Destroy a CALayer.
- * @see #CreateCALayer(int, int, int, int)
+ * @see #CreateCALayer(int, int)
*/
public static void DestroyCALayer(final long caLayer) {
if(0==caLayer) {
@@ -354,9 +356,9 @@ public class OSXUtil implements ToolkitProperties {
private static native void DestroyNSWindow0(long nsWindow);
private static native long GetNSView0(long nsWindow);
private static native long GetNSWindow0(long nsView);
- private static native long CreateCALayer0(int x, int y, int width, int height);
- private static native void AddCASublayer0(long rootCALayer, long subCALayer, int width, int height);
- private static native void FixCALayerLayout0(long rootCALayer, long subCALayer, int width, int height);
+ private static native long CreateCALayer0(int width, int height);
+ private static native void AddCASublayer0(long rootCALayer, long subCALayer, int width, int height, int caLayerQuirks);
+ private static native void FixCALayerLayout0(long rootCALayer, long subCALayer, int width, int height, int caLayerQuirks);
private static native void RemoveCASublayer0(long rootCALayer, long subCALayer);
private static native void DestroyCALayer0(long caLayer);
private static native void RunOnMainThread0(Runnable runnable);
diff --git a/src/nativewindow/native/macosx/NativeWindowProtocols.h b/src/nativewindow/native/macosx/NativeWindowProtocols.h
index b91a50dfd..73c8e65c5 100644
--- a/src/nativewindow/native/macosx/NativeWindowProtocols.h
+++ b/src/nativewindow/native/macosx/NativeWindowProtocols.h
@@ -25,10 +25,27 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
+
+#ifndef NATIVEWINDOWPROTOCOLS_H
+#define NATIVEWINDOWPROTOCOLS_H 1
+/**
+ * CALayer size needs to be set using the AWT component size.
+ * See detailed description in JAWTUtil.java and sync w/ changed.
+ */
+#define NW_DEDICATEDFRAME_QUIRK_SIZE ( 1 << 0 )
+
+/**
+ * CALayer position needs to be set to zero.
+ * See detailed description in JAWTUtil.java and sync w/ changed.
+ */
+#define NW_DEDICATEDFRAME_QUIRK_POSITION ( 1 << 1 )
+
#import <Foundation/NSGeometry.h>
-@protocol NWDedicatedSize
-- (void)setDedicatedSize:(CGSize)size;
+@protocol NWDedicatedFrame
+- (void)setDedicatedFrame:(CGRect)dFrame quirks:(int)quirks;
@end
+#endif /* NATIVEWINDOWPROTOCOLS_H_ */
+
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index 688ef79b8..afe3b3868 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -395,23 +395,23 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: CreateCALayer0
- * Signature: (IIII)J
+ * Signature: (II)J
*/
JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0
- (JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height)
+ (JNIEnv *env, jclass unused, jint width, jint height)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
MyCALayer* layer = [[MyCALayer alloc] init];
- DBG_PRINT("CALayer::CreateCALayer.0: root %p %d/%d %dx%d (refcnt %d)\n", layer, (int)x, (int)y, (int)width, (int)height, (int)[layer retainCount]);
+ DBG_PRINT("CALayer::CreateCALayer.0: root %p 0/0 %dx%d (refcnt %d)\n", layer, (int)width, (int)height, (int)[layer retainCount]);
// avoid zero size
if(0 == width) { width = 32; }
if(0 == height) { height = 32; }
// initial dummy size !
CGRect lRect = [layer frame];
- lRect.origin.x = x;
- lRect.origin.y = y;
+ lRect.origin.x = 0;
+ lRect.origin.y = 0;
lRect.size.width = width;
lRect.size.height = height;
[layer setFrame: lRect];
@@ -428,45 +428,79 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0
return (jlong) ((intptr_t) layer);
}
-static void FixCALayerLayout0(MyCALayer* rootLayer, CALayer* subLayer, jint width, jint height) {
+static void FixCALayerLayout0(MyCALayer* rootLayer, CALayer* subLayer, jint width, jint height, jint caLayerQuirks, jboolean force) {
if( NULL != rootLayer ) {
CGRect lRect = [rootLayer frame];
- if(lRect.origin.x!=0 || lRect.origin.y!=0 || lRect.size.width!=width || lRect.size.height!=height) {
- DBG_PRINT("CALayer::FixCALayerLayout0.0: Root %p frame %lf/%lf %lfx%lf -> 0/0 %dx%d\n",
- rootLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)width, (int)height);
- lRect.origin.x = 0;
- lRect.origin.y = 0;
- lRect.size.width = width;
- lRect.size.height = height;
+ int posQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_POSITION & caLayerQuirks ) && ( lRect.origin.x!=0 || lRect.origin.y!=0 );
+ int sizeQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_SIZE & caLayerQuirks ) && ( lRect.size.width!=width || lRect.size.height!=height );
+ CGFloat _x, _y, _w, _h;
+ // force root -> 0/0
+ _x = 0;
+ _y = 0;
+ posQuirk |= 8;
+ if( sizeQuirk ) {
+ _w = width;
+ _h = height;
+ } else {
+ _w = lRect.size.width;
+ _h = lRect.size.height;
+ }
+ DBG_PRINT("CALayer::FixCALayerLayout0.0: Quirks [%d, pos %d, size %d], Root %p frame %lf/%lf %lfx%lf, usr %dx%d -> %lf/%lf %lfx%lf\n",
+ caLayerQuirks, posQuirk, sizeQuirk, rootLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height,
+ width, height, _x, _y, _w, _h);
+ if( posQuirk || sizeQuirk ) {
+ lRect.origin.x = _x;
+ lRect.origin.y = _y;
+ lRect.size.width = _w;
+ lRect.size.height = _h;
[rootLayer setFrame: lRect];
}
}
if( NULL != subLayer ) {
CGRect lRect = [subLayer frame];
- if(lRect.origin.x!=0 || lRect.origin.y!=0 || lRect.size.width!=width || lRect.size.height!=height) {
- DBG_PRINT("CALayer::FixCALayerLayout0.0: SubL %p frame %lf/%lf %lfx%lf -> 0/0 %dx%d\n",
- subLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)width, (int)height);
- lRect.origin.x = 0;
- lRect.origin.y = 0;
- lRect.size.width = width;
- lRect.size.height = height;
- if( [subLayer conformsToProtocol:@protocol(NWDedicatedSize)] ) {
- CALayer <NWDedicatedSize> * subLayerDS = (CALayer <NWDedicatedSize> *) subLayer;
- [subLayerDS setDedicatedSize: lRect.size];
+ int sizeQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_SIZE & caLayerQuirks ) && ( lRect.size.width!=width || lRect.size.height!=height );
+ CGFloat _x, _y, _w, _h;
+ int posQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_POSITION & caLayerQuirks ) && ( lRect.origin.x!=0 || lRect.origin.y!=0 );
+ if( posQuirk ) {
+ _x = 0;
+ _y = 0;
+ } else {
+ // sub always rel to root
+ _x = lRect.origin.x;
+ _y = lRect.origin.y;
+ }
+ if( sizeQuirk ) {
+ _w = width;
+ _h = height;
+ } else {
+ _w = lRect.size.width;
+ _h = lRect.size.height;
+ }
+ DBG_PRINT("CALayer::FixCALayerLayout1.0: Quirks [%d, pos %d, size %d], SubL %p frame %lf/%lf %lfx%lf, usr %dx%d -> %lf/%lf %lfx%lf\n",
+ caLayerQuirks, posQuirk, sizeQuirk, subLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height,
+ width, height, _x, _y, _w, _h);
+ if( force || posQuirk || sizeQuirk ) {
+ lRect.origin.x = _x;
+ lRect.origin.y = _y;
+ lRect.size.width = _w;
+ lRect.size.height = _h;
+ if( [subLayer conformsToProtocol:@protocol(NWDedicatedFrame)] ) {
+ CALayer <NWDedicatedFrame> * subLayerDS = (CALayer <NWDedicatedFrame> *) subLayer;
+ [subLayerDS setDedicatedFrame: lRect quirks: caLayerQuirks];
} else {
[subLayer setFrame: lRect];
}
- }
+ }
}
}
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: AddCASublayer0
- * Signature: (JJII)V
+ * Signature: (JJIIIII)V
*/
JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
- (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint width, jint height)
+ (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint width, jint height, jint caLayerQuirks)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
@@ -479,20 +513,23 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
[subLayer retain]; // Pairs w/ RemoveCASublayer
CGRect lRectRoot = [rootLayer frame];
- DBG_PRINT("CALayer::AddCASublayer0.0: Origin %p frame0: %lf/%lf %lfx%lf\n",
- rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
- if(lRectRoot.origin.x!=0 || lRectRoot.origin.y!=0) {
- lRectRoot.origin.x = 0;
- lRectRoot.origin.y = 0;
- [rootLayer setFrame: lRectRoot];
- DBG_PRINT("CALayer::AddCASublayer0.1: Origin %p frame*: %lf/%lf %lfx%lf\n",
- rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
+ int posQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_POSITION & caLayerQuirks );
+ int sizeQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_SIZE & caLayerQuirks );
+
+ DBG_PRINT("CALayer::AddCASublayer0.0: Quirks [%d, pos %d, size %d], Root %p (refcnt %d), Sub %p (refcnt %d), frame0: %lf/%lf %lfx%lf\n",
+ caLayerQuirks, posQuirk, sizeQuirk, rootLayer, (int)[rootLayer retainCount], subLayer, (int)[subLayer retainCount],
+ lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
+
+ CGPoint origin = lRectRoot.origin; // save
+ // force root to 0/0
+ lRectRoot.origin.x = 0;
+ lRectRoot.origin.y = 0;
+ [rootLayer setFrame: lRectRoot];
+
+ // simple 1:1 layout rel. to root-layer !
+ if( !posQuirk ) {
+ lRectRoot.origin = origin;
}
- DBG_PRINT("CALayer::AddCASublayer0.2: root %p (refcnt %d) .sub %p %lf/%lf %lfx%lf (refcnt %d)\n",
- rootLayer, (int)[rootLayer retainCount],
- subLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height, (int)[subLayer retainCount]);
-
- // simple 1:1 layout !
[subLayer setFrame:lRectRoot];
[rootLayer addSublayer:subLayer];
@@ -507,7 +544,9 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
[subLayer setAutoresizingMask: (kCALayerWidthSizable|kCALayerHeightSizable)];
[subLayer setNeedsDisplayOnBoundsChange: YES];
- FixCALayerLayout0(rootLayer, subLayer, width, height);
+ if( 0 != caLayerQuirks ) {
+ FixCALayerLayout0(rootLayer, subLayer, width, height, caLayerQuirks, JNI_TRUE);
+ }
[CATransaction commit];
@@ -519,23 +558,25 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: FixCALayerLayout0
- * Signature: (JJII)V
+ * Signature: (JJIIIII)V
*/
JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_FixCALayerLayout0
- (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint width, jint height)
+ (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint width, jint height, int caLayerQuirks)
{
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
- CALayer* subLayer = (CALayer*) ((intptr_t) subCALayer);
+ if( 0 != caLayerQuirks ) {
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
+ CALayer* subLayer = (CALayer*) ((intptr_t) subCALayer);
- [CATransaction begin];
- [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
+ [CATransaction begin];
+ [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
- FixCALayerLayout0(rootLayer, subLayer, width, height);
+ FixCALayerLayout0(rootLayer, subLayer, width, height, caLayerQuirks, JNI_FALSE);
- [CATransaction commit];
+ [CATransaction commit];
- [pool release];
+ [pool release];
+ }
}
/*
@@ -807,7 +848,7 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_RunLater0
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: IsMainThread0
- * Signature: (V)V
+ * Signature: (V)Z
*/
JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_IsMainThread0
(JNIEnv *env, jclass unused)