diff options
Diffstat (limited to 'src/jogl/classes')
16 files changed, 98 insertions, 68 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index a68fc6b2a..ddf5a91f6 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -504,7 +504,7 @@ public class GLEmitter extends ProcAddressEmitter { w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);"); w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;"); w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); - w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); + w.println(" final java.lang.reflect.Field addressField = com.jogamp.common.util.SecurityUtil.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); w.println(" public final java.lang.reflect.Field run() {"); w.println(" java.lang.reflect.Field addressField = null;"); w.println(" for(int i = 0; i < funcNamePermNum; i++) {"); @@ -542,7 +542,7 @@ public class GLEmitter extends ProcAddressEmitter { w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);"); w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;"); w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); - w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); + w.println(" final java.lang.reflect.Field addressField = com.jogamp.common.util.SecurityUtil.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); w.println(" public final java.lang.reflect.Field run() {"); w.println(" java.lang.reflect.Field addressField = null;"); w.println(" for(int i = 0; i < funcNamePermNum; i++) {"); diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java index 76badcda8..5c317bd2b 100644 --- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java +++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java @@ -32,13 +32,13 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.common.net.Uri; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.cache.TempJarCache; import jogamp.graph.font.FontConstructor; @@ -141,7 +141,7 @@ public class FontFactory { final int[] streamLen = { 0 }; final File tempFile[] = { null }; - final InputStream bis = AccessController.doPrivileged(new PrivilegedAction<InputStream>() { + final InputStream bis = SecurityUtil.doPrivileged(new PrivilegedAction<InputStream>() { @Override public InputStream run() { InputStream bis = null; @@ -179,7 +179,7 @@ public class FontFactory { bis.close(); } if( null != tempFile[0] ) { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { tempFile[0].delete(); diff --git a/src/jogl/classes/com/jogamp/opengl/GLProfile.java b/src/jogl/classes/com/jogamp/opengl/GLProfile.java index 8612fc73f..d86c15772 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLProfile.java +++ b/src/jogl/classes/com/jogamp/opengl/GLProfile.java @@ -48,6 +48,7 @@ import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionUtil; import com.jogamp.common.util.cache.TempJarCache; import com.jogamp.common.util.locks.LockFactory; @@ -62,7 +63,6 @@ import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.opengl.fixedfunc.GLPointerFunc; import java.lang.reflect.Constructor; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.List; @@ -222,7 +222,7 @@ public class GLProfile { // run the whole static initialization privileged to speed up, // since this skips checking further access - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { Platform.initSingleton(); @@ -2293,7 +2293,17 @@ public class GLProfile { } else if(GL3 == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL3Available(device, isHardwareRasterizer))) { return desktopCtxUndef ? GL3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_CORE); } else if(GL2 == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL2Available(device, isHardwareRasterizer))) { - return desktopCtxUndef ? GL2 : GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT); + // return desktopCtxUndef ? GL2 : GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT); + if( desktopCtxUndef ) { + return GL2; + } else { + final String gl2_impl = GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT); + if( GL3bc == gl2_impl && !GLContext.isGL3bcAvailable(device, isHardwareRasterizer) ) { + return GL2; + } else { + return gl2_impl; + } + } } else if(GLES3 == profile && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, isHardwareRasterizer))) { return esCtxUndef ? GLES3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_ES); } else if(GLES2 == profile && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES2Available(device, isHardwareRasterizer))) { diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java index 5e6338b5c..52b207b0c 100644 --- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java @@ -33,16 +33,16 @@ import com.jogamp.common.os.DynamicLibraryBundle; import com.jogamp.common.os.DynamicLibraryBundleInfo; import com.jogamp.common.os.Platform; import com.jogamp.common.util.RunnableExecutor; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.cache.TempJarCache; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.*; public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { private static final List<String> glueLibNames; static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { Platform.initSingleton(); diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index 68586dfc5..36d35cde9 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -32,12 +32,12 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.opengl.GLException; import com.jogamp.common.util.IntObjectHashMap; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontSet; import com.jogamp.graph.font.FontFactory; @@ -68,7 +68,7 @@ public class JavaFontLoader implements FontSet { final String javaFontPath; private JavaFontLoader() { - final String javaHome = AccessController.doPrivileged(new PrivilegedAction<String>() { + final String javaHome = SecurityUtil.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return System.getProperty("java.home"); @@ -158,7 +158,7 @@ public class JavaFontLoader implements FontSet { private Font abspathImpl(final String fname, final int family, final int style) throws IOException { final Exception[] privErr = { null }; final int[] streamLen = { 0 }; - final InputStream stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() { + final InputStream stream = SecurityUtil.doPrivileged(new PrivilegedAction<InputStream>() { @Override public InputStream run() { try { diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index 78140df6f..71d18b17e 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -36,12 +36,12 @@ import com.jogamp.common.os.Platform; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.common.util.JarUtil; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.cache.TempJarCache; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontSet; import com.jogamp.graph.font.FontFactory; -import java.security.AccessController; import java.security.PrivilegedAction; public class UbuntuFontLoader implements FontSet { @@ -139,7 +139,7 @@ public class UbuntuFontLoader implements FontSet { if( TempJarCache.isInitialized(false) ) { try { final Uri uri = JarUtil.getRelativeOf(UbuntuFontLoader.class, jarSubDir, jarName); - final Exception e0 = AccessController.doPrivileged(new PrivilegedAction<Exception>() { + final Exception e0 = SecurityUtil.doPrivileged(new PrivilegedAction<Exception>() { @Override public Exception run() { try { @@ -173,7 +173,7 @@ public class UbuntuFontLoader implements FontSet { final InputStream stream; if( useTempJARCache ) { final Exception[] privErr = { null }; - stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() { + stream = SecurityUtil.doPrivileged(new PrivilegedAction<InputStream>() { @Override public InputStream run() { try { diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java index 5273eead7..cc239fefc 100644 --- a/src/jogl/classes/jogamp/opengl/Debug.java +++ b/src/jogl/classes/jogamp/opengl/Debug.java @@ -28,10 +28,10 @@ package jogamp.opengl; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.common.util.PropertyAccess; +import com.jogamp.common.util.SecurityUtil; /** Helper routines for logging and debugging. */ @@ -41,7 +41,7 @@ public class Debug extends PropertyAccess { private static final boolean debugAll; static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { PropertyAccess.addTrustedPrefix("jogl."); diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 68c21b84c..d97e0e201 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -42,7 +42,6 @@ package jogamp.opengl; import java.lang.reflect.Method; import java.nio.IntBuffer; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.IdentityHashMap; @@ -55,6 +54,7 @@ import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.common.os.Platform; import com.jogamp.common.util.Bitfield; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionNumber; import com.jogamp.common.util.VersionNumberString; import com.jogamp.common.util.locks.RecursiveLock; @@ -86,6 +86,29 @@ import com.jogamp.opengl.GLPipelineFactory; import com.jogamp.opengl.GLProfile; public abstract class GLContextImpl extends GLContext { + + /** Selected {@link Platform.OSType#MACOS} or {@link Platform.OSType#IOS} {@link VersionNumber}s. */ + public static class MacOSVersion { + /** OSX Lion, i.e. 10.7.0 */ + public static final VersionNumber Lion; + /** OSX Mavericks, i.e. 10.9.0 */ + public static final VersionNumber Mavericks; + /** OSX Mojave, i.e. 10.14.0 */ + public static final VersionNumber Mojave; + + static { + if( Platform.getOSType() == Platform.OSType.MACOS ) { + Lion = new VersionNumber(10,7,0); + Mavericks = new VersionNumber(10,9,0); + Mojave = new VersionNumber(10,14,0); + } else { + Lion = null; + Mavericks = null; + Mojave = null; + } + } + } + /** * Context full qualified name: display_type + display_connection + major + minor + ctp. * This is the key for all cached GL ProcAddressTables, etc, to support multi display/device setups. @@ -1022,7 +1045,8 @@ public abstract class GLContextImpl extends GLContext { this.preCtxVersion = preCtxVersion; this.preCtxOptions = preCtxOptions; } - public final String toString() { + @Override + public final String toString() { return toString(new StringBuilder(), -1, -1, -1, -1).toString(); } public final StringBuilder toString(final StringBuilder sb, final int minMajor, final int minMinor, final int maxMajor, final int maxMinor) { @@ -1226,7 +1250,7 @@ public abstract class GLContextImpl extends GLContext { // ensuring proper user behavior across platforms due to different feature sets! // if( Platform.OSType.MACOS == Platform.getOSType() && - Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Mavericks) >= 0 ) { + Platform.getOSVersionNumber().compareTo(MacOSVersion.Mavericks) >= 0 ) { /** * OSX 10.9 GLRendererQuirks.GL4NeedsGL3Request, quirk is added as usual @ setRendererQuirks(..) */ @@ -1621,7 +1645,7 @@ public abstract class GLContextImpl extends GLContext { GLEmitter by looking up anew all of its function pointers using the given {@link GLDynamicLookupHelper}. */ protected final void resetProcAddressTable(final ProcAddressTable table, final GLDynamicLookupHelper dlh) { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { table.reset( dlh ); @@ -1777,7 +1801,7 @@ public abstract class GLContextImpl extends GLContext { final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice(); if( !glGetPtrInit ) { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { final GLDynamicLookupHelper glDynLookupHelper = getGLDynamicLookupHelper(reqMajor, reqCtxProfileBits); @@ -2323,7 +2347,7 @@ public abstract class GLContextImpl extends GLContext { } quirks.addQuirk( quirk ); } - if( Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Mavericks) >= 0 && 3==reqMajor && 4==hasMajor ) { + if( Platform.getOSVersionNumber().compareTo(MacOSVersion.Mavericks) >= 0 && 3==reqMajor && 4==hasMajor ) { final int quirk = GLRendererQuirks.GL4NeedsGL3Request; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", req "+reqMajor+"."+reqMinor); @@ -2339,7 +2363,7 @@ public abstract class GLContextImpl extends GLContext { } quirks.addQuirk( quirk ); } - if( Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Lion) < 0 ) { // < OSX 10.7.0 w/ NV has unstable GLSL + if( Platform.getOSVersionNumber().compareTo(MacOSVersion.Lion) < 0 ) { // < OSX 10.7.0 w/ NV has unstable GLSL final int quirk = GLRendererQuirks.GLSLNonCompliant; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", Renderer "+glRenderer); @@ -2665,7 +2689,7 @@ public abstract class GLContextImpl extends GLContext { throw new GLException("No GLDynamicLookupHelper for "+this); } final String tmpBase = GLNameResolver.normalizeVEN(GLNameResolver.normalizeARB(glFunctionName, true), true); - return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + return SecurityUtil.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { boolean res = false; diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index fb4529da4..410ad46e8 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -27,7 +27,6 @@ */ package jogamp.opengl; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; @@ -41,6 +40,7 @@ import jogamp.common.os.PlatformPropsImpl; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.GLExtensions; @@ -114,7 +114,7 @@ public class GLDebugMessageHandler { } private final long getAddressFor(final ProcAddressTable table, final String functionName) { - return AccessController.doPrivileged(new PrivilegedAction<Long>() { + return SecurityUtil.doPrivileged(new PrivilegedAction<Long>() { @Override public Long run() { try { diff --git a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java index 8545f10bf..e65e79b63 100644 --- a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java +++ b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java @@ -35,7 +35,6 @@ package jogamp.opengl; import java.lang.reflect.InvocationTargetException; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.nativewindow.NativeWindowFactory; @@ -46,6 +45,7 @@ import com.jogamp.opengl.Threading.Mode; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.SecurityUtil; /** Implementation of the {@link com.jogamp.opengl.Threading} class. */ @@ -63,7 +63,7 @@ public class ThreadingImpl { static { threadingPlugin = - AccessController.doPrivileged(new PrivilegedAction<ToolkitThreadingPlugin>() { + SecurityUtil.doPrivileged(new PrivilegedAction<ToolkitThreadingPlugin>() { @Override public ToolkitThreadingPlugin run() { final String singleThreadProp; diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java index 7f6c48ee2..8fb45a3a0 100644 --- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java +++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java @@ -48,7 +48,6 @@ import java.awt.Rectangle; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.opengl.GL; @@ -58,6 +57,7 @@ import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLProfile; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.SecurityUtil; import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.Debug; @@ -118,7 +118,7 @@ public class Java2D { private static Method destroyOGLContextMethod; static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { if (DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 38f5bb727..2c200b664 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -101,16 +101,30 @@ public class MacOSXCGLContext extends GLContextImpl boolean swapBuffers(); } - /* package */ static final boolean isTigerOrLater; - /* package */ static final boolean isLionOrLater; - /* package */ static final boolean isMavericksOrLater; + /* package */ static final boolean isLionOrLater; // >= 10.7.0 + /* package */ static final boolean isMavericksOrLater; // >= 10.9.0 + /* package */ static final boolean isMojaveOrLater; // >= 10.14.0 private static final boolean DEBUG1398; static { final VersionNumber osvn = Platform.getOSVersionNumber(); - isTigerOrLater = osvn.compareTo(Platform.OSXVersion.Tiger) >= 0; - isLionOrLater = osvn.compareTo(Platform.OSXVersion.Lion) >= 0; - isMavericksOrLater = osvn.compareTo(Platform.OSXVersion.Mavericks) >= 0; + if( osvn.compareTo(MacOSVersion.Mojave) >= 0 ) { + isLionOrLater = true; + isMavericksOrLater = true; + isMojaveOrLater = true; + } else if( osvn.compareTo(MacOSVersion.Mavericks) >= 0 ) { + isLionOrLater = true; + isMavericksOrLater = true; + isMojaveOrLater = false; + } else if( osvn.compareTo(MacOSVersion.Lion) >= 0 ) { + isLionOrLater = true; + isMavericksOrLater = false; + isMojaveOrLater = false; + } else { + isLionOrLater = false; + isMavericksOrLater = false; + isMojaveOrLater = false; + } DEBUG1398 = Debug.debug("Bug1398"); } @@ -369,16 +383,7 @@ public class MacOSXCGLContext extends GLContextImpl isIncompleteView = false; } if( !isIncompleteView ) { - if( useAppKit ) { - OSXUtil.RunOnMainThread(true, false, new Runnable() { - @Override - public void run() { - updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); - } - }); - } else { - updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); - } + updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle(), false /* useAppKit .. onMain */); if(0 == updateHandle) { throw new InternalError("XXX2"); } @@ -395,7 +400,6 @@ public class MacOSXCGLContext extends GLContextImpl } } - private static boolean useAppKit = false; @Override protected void drawableUpdatedNotify() throws GLException { if( drawable.getChosenGLCapabilities().isOnscreen() ) { @@ -410,16 +414,7 @@ public class MacOSXCGLContext extends GLContextImpl if (contextHandle == 0) { throw new GLException("Context not created"); } - if( useAppKit ) { - OSXUtil.RunOnMainThread(true, false, new Runnable() { - @Override - public void run() { - CGL.updateContext(contextHandle); - } - }); - } else { - CGL.updateContext(contextHandle); - } + CGL.updateContext(contextHandle, true /* useAppKit .. onMain */); } } } @@ -1174,7 +1169,8 @@ public class MacOSXCGLContext extends GLContextImpl if( !drawableAssociated ) { lastNSViewDescr = null; lastSetNSViewCmd = null; - OSXUtil.RunOnMainThread(true /* wait */, true /* kickNSApp */, new Runnable() { + final boolean wait = !MacOSXCGLContext.isMojaveOrLater; // wait if < 10.14 + OSXUtil.RunOnMainThread(wait, true /* kickNSApp */, new Runnable() { @Override public void run() { CGL.setContextView(ctx, 0); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java index e42cc7af9..f1049ce6e 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -28,7 +28,6 @@ package jogamp.opengl.util.av.impl; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Arrays; @@ -41,6 +40,7 @@ import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.DynamicLibraryBundle; import com.jogamp.common.os.DynamicLibraryBundleInfo; import com.jogamp.common.util.RunnableExecutor; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionNumber; /** @@ -217,7 +217,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { throw new InternalError("XXX0 "+symbolNames.length+" != "+symbolCount); } - final DynamicLibraryBundle dl = AccessController.doPrivileged(privInitSymbolsAction); + final DynamicLibraryBundle dl = SecurityUtil.doPrivileged(privInitSymbolsAction); if( null == dl ) { return false; } diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java index 74103fe31..6e44dcc37 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -30,7 +30,6 @@ package jogamp.opengl.util.av.impl; import java.io.IOException; import java.nio.ByteBuffer; -import java.security.AccessController; import java.security.PrivilegedAction; import com.jogamp.opengl.GL; @@ -39,6 +38,7 @@ import com.jogamp.opengl.GLException; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.PropertyAccess; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionNumber; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.util.TimeFrameI; @@ -422,7 +422,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { final int audioQueueLimit; if( null != gl && STREAM_ID_NONE != getVID() ) { final GLContextImpl ctx = (GLContextImpl)gl.getContext(); - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { final ProcAddressTable pt = ctx.getGLProcAddressTable(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 652184e7e..d65027f0d 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -42,7 +42,6 @@ package jogamp.opengl.windows.wgl; import java.nio.Buffer; import java.nio.ShortBuffer; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; @@ -78,6 +77,7 @@ import jogamp.opengl.SharedResourceRunner; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.windows.WindowsGraphicsDevice; import com.jogamp.opengl.GLExtensions; @@ -155,7 +155,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { synchronized(WindowsWGLDrawableFactory.class) { if( null == windowsWGLDynamicLookupHelper ) { - windowsWGLDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DesktopGLDynamicLookupHelper>() { + windowsWGLDynamicLookupHelper = SecurityUtil.doPrivileged(new PrivilegedAction<DesktopGLDynamicLookupHelper>() { @Override public DesktopGLDynamicLookupHelper run() { DesktopGLDynamicLookupHelper tmp; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index a03ce1641..85482679b 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -39,7 +39,6 @@ package jogamp.opengl.x11.glx; import java.nio.Buffer; import java.nio.ShortBuffer; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; @@ -72,6 +71,7 @@ import jogamp.opengl.SharedResourceRunner; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionNumber; import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.x11.X11GraphicsDevice; @@ -96,7 +96,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { synchronized(X11GLXDrawableFactory.class) { if( null == x11GLXDynamicLookupHelper ) { - x11GLXDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DesktopGLDynamicLookupHelper>() { + x11GLXDynamicLookupHelper = SecurityUtil.doPrivileged(new PrivilegedAction<DesktopGLDynamicLookupHelper>() { @Override public DesktopGLDynamicLookupHelper run() { DesktopGLDynamicLookupHelper tmp; |