diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 52 |
1 files changed, 24 insertions, 28 deletions
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); |