Made resource fork on OS X obsolete. We still do add it just in case, but should the data be lost during a copy process through a different file system, the app will still put itself in the foreground if using a GUI (STR #1453)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5627 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
84ad997529
commit
e9e0826d10
1
CHANGES
1
CHANGES
@ -1,5 +1,6 @@
|
||||
CHANGES IN FLTK 1.1.8
|
||||
|
||||
- OS X resource fork now obsolete (STR #1453)
|
||||
- Added chapter 10 about multithreading (STR #1532,
|
||||
1533)
|
||||
- OS X system menu bar itop level attribute support
|
||||
|
@ -1264,8 +1264,16 @@ void fl_open_callback(void (*cb)(const char *)) {
|
||||
|
||||
|
||||
/**
|
||||
* initialize the Mac toolboxes and set the default menubar
|
||||
* initialize the Mac toolboxes, dock status, and set the default menubar
|
||||
*/
|
||||
|
||||
#ifndef MAC_OS_X_VERSION_10_3
|
||||
extern "C" {
|
||||
extern OSErr CPSEnableForegroundOperation(ProcessSerialNumber *psn, UInt32 _arg2,
|
||||
UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
|
||||
}
|
||||
#endif
|
||||
|
||||
void fl_open_display() {
|
||||
static char beenHereDoneThat = 0;
|
||||
if ( !beenHereDoneThat ) {
|
||||
@ -1284,6 +1292,42 @@ void fl_open_display() {
|
||||
ClearMenuBar();
|
||||
AppendResMenu( GetMenuHandle( 1 ), 'DRVR' );
|
||||
DrawMenuBar();
|
||||
|
||||
// bring the application into foreground without a 'CARB' resource
|
||||
Boolean same_psn;
|
||||
ProcessSerialNumber cur_psn, front_psn;
|
||||
if( !GetCurrentProcess( &cur_psn ) && !GetFrontProcess( &front_psn ) &&
|
||||
!SameProcess( &front_psn, &cur_psn, &same_psn ) && !same_psn )
|
||||
{
|
||||
// only transform the application type for unbundled apps
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
if( bundle )
|
||||
{
|
||||
FSRef execFs;
|
||||
CFURLRef execUrl = CFBundleCopyExecutableURL( bundle );
|
||||
CFURLGetFSRef( execUrl, &execFs );
|
||||
|
||||
FSRef bundleFs;
|
||||
GetProcessBundleLocation( &cur_psn, &bundleFs );
|
||||
|
||||
if( !FSCompareFSRefs( &execFs, &bundleFs ) )
|
||||
bundle = NULL;
|
||||
|
||||
CFRelease(execUrl);
|
||||
}
|
||||
|
||||
if( !bundle )
|
||||
{
|
||||
#ifdef MAC_OS_X_VERSION_10_3
|
||||
// newer supported API
|
||||
if( !TransformProcessType( &cur_psn, kProcessTransformToForegroundApplication ) )
|
||||
#else
|
||||
// undocumented API
|
||||
if( !CPSEnableForegroundOperation( &cur_psn, 0x03, 0x3C, 0x2C, 0x1103 ) )
|
||||
#endif
|
||||
SetFrontProcess( &cur_psn );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user