Improved portability to diverse Mac O X versions

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7724 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-10-18 10:49:04 +00:00
parent 0d6987a160
commit 19231291e6
1 changed files with 22 additions and 11 deletions

View File

@ -349,11 +349,21 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
aglSetInteger( context, AGL_BUFFER_RECT, rect );
aglEnable( context, AGL_BUFFER_RECT );
}
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
aglSetWindowRef(context, MACwindowRef(w) );
# else
aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
# endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#if __LP64__
// 64 bit version
aglSetWindowRef(context, MACwindowRef(w) );
#else
// 32 bit version >= 10.5
if (aglSetWindowRef != NULL)
aglSetWindowRef(context, MACwindowRef(w) );
else
aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
#endif
#else
// 32 bit version < 10.5
aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
#endif
aglSetCurrentContext(context);
# else
# error unsupported platform
@ -370,12 +380,13 @@ void fl_no_gl_context() {
wglMakeCurrent(0, 0);
# elif defined(__APPLE_QUARTZ__)
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
AGLContext ctx = aglGetCurrentContext();
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (ctx) aglSetWindowRef(ctx, NULL);
# else
if (ctx) aglSetDrawable(ctx, NULL);
# endif
AGLContext ctx = aglGetCurrentContext();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (aglSetWindowRef != NULL)
{ if(ctx) aglSetWindowRef(ctx, NULL ); }
else
#endif
if(ctx) aglSetDrawable( ctx, NULL );
aglSetCurrentContext(0);
# else
# error unsupported platform