diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2009-09-13 09:53:07 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2009-09-13 09:53:07 +0000 |
| commit | b863eed5eca84b876869612d2f33d5fb647b2034 (patch) | |
| tree | c3530d25a76c763cf3011b7412fd25d0c66f1b9c /src | |
| parent | cec4292c32a543ca0cef56fcd16ecc079404ab8e (diff) | |
Fixed occasional international keyboard problems on OS X thanks to misleading indentation.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6860 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_mac.cxx | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index a92573ac1..609caa83c 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1496,10 +1496,10 @@ void fl_open_display() { beenHereDoneThat = 1; FlushEvents(everyEvent,0); - + MoreMasters(); // \todo Carbon suggests MoreMasterPointers() AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false ); - + // create the Mac Handle for the default cursor (a pointer to a pointer) GetQDGlobalsArrow(&default_cursor); default_cursor_ptr = &default_cursor; @@ -1508,12 +1508,12 @@ 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 ) + !SameProcess( &front_psn, &cur_psn, &same_psn ) && !same_psn ) { // only transform the application type for unbundled apps CFBundleRef bundle = CFBundleGetMainBundle(); @@ -1522,35 +1522,16 @@ void fl_open_display() { FSRef execFs; CFURLRef execUrl = CFBundleCopyExecutableURL( bundle ); CFURLGetFSRef( execUrl, &execFs ); - + FSRef bundleFs; GetProcessBundleLocation( &cur_psn, &bundleFs ); - + if( !FSCompareFSRefs( &execFs, &bundleFs ) ) bundle = NULL; - + CFRelease(execUrl); } - - // imm: keycode handler stub setting - use Gestalt to determine the running system version, - // then set the keycode_function pointer accordingly - SInt32 MacVersion; - if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr) - { -// SInt32 maj, min, fix; -// Gestalt(gestaltSystemVersionMajor, &maj); // e.g. 10 -// Gestalt(gestaltSystemVersionMinor, &min); // e.g. 4 -// Gestalt(gestaltSystemVersionBugFix, &fix); // e.g. 11 - if(MacVersion >= 0x1050) { // 10.5.0 or later - keycode_function = keycodeToUnicode; - } - else { - keycode_function = keycode_wrap_old; // pre-10.5 mechanism - } - } - // else our default handler will be used (keycode_wrap_old) - - + if( !bundle ) { // Earlier versions of this code tried to use weak linking, however it @@ -1558,19 +1539,30 @@ void fl_open_display() { // 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 + 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); - + err = CPSEnableForegroundOperation(&cur_psn, 0x03, 0x3C, 0x2C, 0x1103); + if (err == noErr) { - SetFrontProcess( &cur_psn ); + SetFrontProcess( &cur_psn ); } } } + + // imm: keycode handler stub setting - use Gestalt to determine the running system version, + // then set the keycode_function pointer accordingly + keycode_function = keycode_wrap_old; // default to pre-10.5 mechanism + SInt32 MacVersion; + if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr) + { + if(MacVersion >= 0x1050) { // 10.5.0 or later + keycode_function = keycodeToUnicode; + } + } } } |
