Author: manolo
Date: 2011-10-22 08:22:28 -0700 (Sat, 22 Oct 2011)
New Revision: 9145
Log:
Mac OS: the procedure used to restore visible focus to a window after using an 
Fl_Native_File_Chooser
window failed under OS X 10.7. It's replaced by a simpler, OS 
version-independent procedure.

Modified:
   branches/branch-3.0/src/fltk3/cocoa.mm
   branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm

Modified: branches/branch-3.0/src/fltk3/cocoa.mm
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa.mm      2011-10-22 15:12:57 UTC (rev 
9144)
+++ branches/branch-3.0/src/fltk3/cocoa.mm      2011-10-22 15:22:28 UTC (rev 
9145)
@@ -933,7 +933,6 @@
 - (void)windowDidDeminiaturize:(NSNotification *)notif;
 - (void)windowDidMiniaturize:(NSNotification *)notif;
 - (void)windowWillClose:(NSNotification *)notif;
-- (void)anywindowwillclosenotif:(NSNotification *)notif;
 - 
(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender;
 - (void)applicationDidBecomeActive:(NSNotification *)notify;
 - (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification;
@@ -1037,18 +1036,6 @@
   }
   fl_unlock_function();
 }
-- (void)anywindowwillclosenotif:(NSNotification *)notif
-{
-  // necessary so that after closing a non-FLTK window (e.g., 
fltk3::NativeFileChooser)
-  // the front window turns key again
-  NSWindow *closing = (NSWindow*)[notif object];
-  if ([closing isMemberOfClass:[FLWindow class]]) return;
-  NSWindow *nsk = [NSApp keyWindow];
-  NSWindow *nsm = [NSApp mainWindow];
-  if ([nsm isMemberOfClass:[FLWindow class]] && nsk == nil) {
-    [nsm makeKeyAndOrderFront:nil];
-  }
-}
 - 
(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
 {
   fl_lock_function();
@@ -1305,11 +1292,6 @@
     }
     if (![NSApp servicesMenu]) createAppleMenu();
     fl_system_menu = [NSApp mainMenu];
-    
-    [[NSNotificationCenter defaultCenter] addObserver:[NSApp delegate] 
-              selector:@selector(anywindowwillclosenotif:) 
-                  name:NSWindowWillCloseNotification 
-                object:nil];
     main_screen_height = [[[NSScreen screens] objectAtIndex:0] 
frame].size.height;
   }
 }

Modified: branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm
===================================================================
--- branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm     2011-10-22 
15:12:57 UTC (rev 9144)
+++ branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm     2011-10-22 
15:22:28 UTC (rev 9145)
@@ -541,6 +541,7 @@
   }
   
   // SHOW THE DIALOG
+  NSWindow *key = [NSApp keyWindow];
   if ( [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]] ) {
     NSPopUpButton *popup = nil;
     if (_filt_total) {
@@ -618,6 +619,7 @@
     [preset release];
     if ( retval == NSOKButton ) get_saveas_basename();
   }
+  [key makeKeyWindow];
   [localPool release];
   return (retval == NSOKButton ? 0 : 1);
 }

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

Reply via email to