diff options
author | Sven Gothel <[email protected]> | 2023-01-18 00:12:24 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-18 00:12:24 +0100 |
commit | 95c3d9162693c0e655bd8764faefd8126a3ec982 (patch) | |
tree | b921babc94a44a1a55b1b9f3a0474fec04219849 /src | |
parent | 736a127297aa561ea5967acd66d61d494646dca3 (diff) |
JAWTWindow: Constrain AppContextInfo creation where offscreen layer is supported (MacOS only)
Diffstat (limited to 'src')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 11 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 5d2938603..b8c68478a 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -88,7 +88,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, // lifetime: forever protected final Component component; - private final AppContextInfo appContextInfo; + private final AppContextInfo appContextInfo; // only used for offscreen layer, i.e. MacOS only private final SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper(); private final RecursiveLock surfaceLock = LockFactory.createRecursiveLock(); private final JAWTComponentListener jawtComponentListener; @@ -123,7 +123,11 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, if(! ( config instanceof AWTGraphicsConfiguration ) ) { throw new NativeWindowException("Error: AbstractGraphicsConfiguration is not an AWTGraphicsConfiguration: "+config); } - appContextInfo = new AppContextInfo("<init>"); + if( JAWTUtil.isOffscreenLayerSupported() ) { + appContextInfo = new AppContextInfo("<init>"); + } else { + appContextInfo = null; + } this.component = (Component)comp; this.jawtComponentListener = new JAWTComponentListener(); invalidate(); @@ -484,6 +488,9 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, @Override public final void attachSurfaceLayer(final long layerHandle) throws NativeWindowException { + if( null == appContextInfo ) { // !JAWTUtil.isOffscreenLayerSupported() + throw new NativeWindowException("Offscreen layer not supported"); + } if( !isOffscreenLayerSurfaceEnabled() ) { throw new NativeWindowException("Not an offscreen layer surface"); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index a28ed8235..518abc491 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -122,6 +122,8 @@ public class JAWTUtil { /** * Returns true if this platform's JAWT implementation supports offscreen layer. + * + * Currently only JAWT on MacOS >= 10.6.4 supports offscreen rendering. */ public static boolean isOffscreenLayerSupported() { return PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS && MacOS_10_6_4_COMPARE >= 0; @@ -129,6 +131,8 @@ public class JAWTUtil { /** * Returns true if this platform's JAWT implementation requires using offscreen layer. + * + * Currently only JAWT on MacOS with JVM >= 1.7 supports offscreen rendering. */ public static boolean isOffscreenLayerRequired() { return PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS && MacOS_JVM_1_7_COMPARE >= 0; |