Author: manolo
Date: 2010-10-18 03:49:04 -0700 (Mon, 18 Oct 2010)
New Revision: 7724
Log:
Improved portability to diverse Mac O X versions

Modified:
   branches/branch-1.3/src/Fl_Gl_Choice.cxx

Modified: branches/branch-1.3/src/Fl_Gl_Choice.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Gl_Choice.cxx    2010-10-17 19:39:41 UTC (rev 
7723)
+++ branches/branch-1.3/src/Fl_Gl_Choice.cxx    2010-10-18 10:49:04 UTC (rev 
7724)
@@ -349,11 +349,21 @@
       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 @@
   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

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to