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.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9144 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-10-22 15:12:57 +00:00
parent babac08474
commit 81fcaed456
2 changed files with 2 additions and 18 deletions

View File

@ -532,6 +532,7 @@ int Fl_Native_File_Chooser::post() {
}
// SHOW THE DIALOG
NSWindow *key = [NSApp keyWindow];
if ( [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]] ) {
NSPopUpButton *popup = nil;
if (_filt_total) {
@ -609,6 +610,7 @@ int Fl_Native_File_Chooser::post() {
[preset release];
if ( retval == NSOKButton ) get_saveas_basename();
}
[key makeKeyWindow];
[localPool release];
return (retval == NSOKButton ? 0 : 1);
}

View File

@ -932,7 +932,6 @@ void fl_open_callback(void (*cb)(const char *)) {
- (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;
@ -1036,18 +1035,6 @@ void fl_open_callback(void (*cb)(const char *)) {
}
fl_unlock_function();
}
- (void)anywindowwillclosenotif:(NSNotification *)notif
{
// necessary so that after closing a non-FLTK window (e.g., Fl_Native_File_Chooser)
// 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();
@ -1304,11 +1291,6 @@ void fl_open_display() {
}
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;
}
}