summaryrefslogtreecommitdiff
path: root/src/Fl_Gl_Choice.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-10-18 10:49:04 +0000
committerManolo Gouy <Manolo>2010-10-18 10:49:04 +0000
commit19231291e67f8aeefcf29bbb8e269615ea0a819d (patch)
treeb5d0e230dba2f45ea916d04de3a43120b688f6d1 /src/Fl_Gl_Choice.cxx
parent0d6987a160695342a5491de37b9859583401e433 (diff)
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
Diffstat (limited to 'src/Fl_Gl_Choice.cxx')
-rw-r--r--src/Fl_Gl_Choice.cxx33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx
index 7d3a238ab..7dd4bc947 100644
--- a/src/Fl_Gl_Choice.cxx
+++ b/src/Fl_Gl_Choice.cxx
@@ -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