summaryrefslogtreecommitdiff
path: root/src/Fl_Gl_Choice.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-01-03 16:50:34 +0000
committerManolo Gouy <Manolo>2011-01-03 16:50:34 +0000
commit874bca74f55f686ded8f0b3d2df08196911f26f0 (patch)
treef1d394945f49314ee4a8706a4b98daf8ec830ce8 /src/Fl_Gl_Choice.cxx
parentbb6392f7ec94ba682ebade1d5b30eba9ff30ceb1 (diff)
Mac OS X: removed all uses of Carbon (except for older OS versions) and re-organized
text input around the NSTextInput protocol. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8173 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Gl_Choice.cxx')
-rw-r--r--src/Fl_Gl_Choice.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx
index fa99d2705..df6267650 100644
--- a/src/Fl_Gl_Choice.cxx
+++ b/src/Fl_Gl_Choice.cxx
@@ -37,8 +37,8 @@
# include <FL/fl_utf8.h>
# ifdef __APPLE__
+# include <ApplicationServices/ApplicationServices.H>
# include <FL/Fl_Window.H>
-# include <Carbon/Carbon.h>
# endif
# ifdef WIN32
@@ -296,6 +296,14 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
}
# elif defined(__APPLE_QUARTZ__)
+static CGrafPtr fl_GetWindowPort(WindowRef window)
+{
+ typedef CGrafPtr (*wf)(WindowRef);
+ static wf f = NULL;
+ if ( ! f) f = (wf)Fl_X::get_carbon_function("GetWindowPort");
+ return (*f)(window);
+}
+
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
GLContext context, shared_ctx = 0;
@@ -312,17 +320,17 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#if __LP64__
// 64 bit version
- aglSetWindowRef(context, Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ );
+ aglSetWindowRef(context, Fl_X::i(window)->window_ref() );
#else
// 32 bit version >= 10.5
if (aglSetWindowRef != NULL)
- aglSetWindowRef(context, Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ );
+ aglSetWindowRef(context, Fl_X::i(window)->window_ref() );
else
- aglSetDrawable( context, GetWindowPort( Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ ) );
+ aglSetDrawable( context, fl_GetWindowPort( Fl_X::i(window)->window_ref() ) );
#endif
#else
// 32 bit version < 10.5
- aglSetDrawable( context, GetWindowPort( Fl_X::i(window)->window_ref()/*fl_mac_windowref(window)*/ ) );
+ aglSetDrawable( context, fl_GetWindowPort( Fl_X::i(window)->window_ref() ) );
#endif
return (context);
}
@@ -352,17 +360,17 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#if __LP64__
// 64 bit version
- aglSetWindowRef(context, Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ );
+ aglSetWindowRef(context, Fl_X::i(w)->window_ref() );
#else
// 32 bit version >= 10.5
if (aglSetWindowRef != NULL)
- aglSetWindowRef(context, Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ );
+ aglSetWindowRef(context, Fl_X::i(w)->window_ref() );
else
- aglSetDrawable( context, GetWindowPort( Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ ) );
+ aglSetDrawable( context, fl_GetWindowPort( Fl_X::i(w)->window_ref() ) );
#endif
#else
// 32 bit version < 10.5
- aglSetDrawable( context, GetWindowPort( Fl_X::i(w)->window_ref()/*fl_mac_windowref(w)*/ ) );
+ aglSetDrawable( context, fl_GetWindowPort( Fl_X::i(w)->window_ref() ) );
#endif
aglSetCurrentContext(context);
# else