diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-01-23 21:48:17 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-01-23 21:48:17 +0000 |
| commit | f8d84949c43917ffea5d9b6a998db2360f9d82f6 (patch) | |
| tree | ab4b0f766db552dcede8d2d4fca55ffd375b68b9 /src | |
| parent | 28b3753946478b11cd5cf04793c8b959fbda0f82 (diff) | |
Refine the weak-binding solution...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5637 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_mac.cxx | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 153867b9a..6d755a222 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -3,7 +3,7 @@ // // MacOS specific code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2006 by Bill Spitzak and others. +// Copyright 1998-2007 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -1270,16 +1270,7 @@ void fl_open_callback(void (*cb)(const char *)) { extern "C" { extern OSErr CPSEnableForegroundOperation(ProcessSerialNumber *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); -#ifndef MAC_OS_X_VERSION_10_3 - enum { - kProcessTransformToForegroundApplication = 1L - }; - typedef UInt32 ProcessApplicationTransformState; - extern OSStatus TransformProcessType(const ProcessSerialNumber *psn, - ProcessApplicationTransformState transformState); -#endif } -//#endif void fl_open_display() { static char beenHereDoneThat = 0; @@ -1325,12 +1316,19 @@ void fl_open_display() { if( !bundle ) { - OSErr err = 1; + // Earlier versions of this code tried to use weak linking, however it + // appears that this does not work on 10.2. Since 10.3 and higher provide + // both TransformProcessType and CPSEnableForegroundOperation, the following + // conditional code compiled on 10.2 will still work on newer releases... + OSErr err; + +#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 if (TransformProcessType != NULL) { - err = TransformProcessType(&cur_psn, kProcessTransformToForegroundApplication); - } else if (CPSEnableForegroundOperation != NULL) { - err = CPSEnableForegroundOperation(&cur_psn, 0x03, 0x3C, 0x2C, 0x1103); - } + err = TransformProcessType(&cur_psn, kProcessTransformToForegroundApplication); + } else +#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 + err = CPSEnableForegroundOperation(&cur_psn, 0x03, 0x3C, 0x2C, 0x1103); + if (err == noErr) { SetFrontProcess( &cur_psn ); } |
