From 353f59a0ce663d3018e6d0d6edac08bb0783f5af Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 26 Oct 2011 12:42:41 +0000 Subject: Mac OS: restore the focus to the top FLTK window after closing the window opened by the "About ..." item of the application menu. This issue appeared with OS X 10.7. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9152 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index db2fbd70d..07dbaa6b3 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2825,6 +2825,7 @@ void Fl_X::set_cursor(Fl_Cursor c) } - (void)showPanel; - (void)printPanel; +- (void)closePanel:(NSNotification *)notif; @end @implementation FLaboutItemTarget - (void)showPanel @@ -2836,7 +2837,16 @@ void Fl_X::set_cursor(Fl_Cursor c) FL_MAJOR_VERSION, FL_MINOR_VERSION ]] autorelease], @"Credits", nil]; [NSApp orderFrontStandardAboutPanelWithOptions:options]; - } + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(closePanel:) + name:NSWindowWillCloseNotification + object:[NSApp keyWindow]]; +} +- (void)closePanel:(NSNotification *)notif +{ + [[NSApp delegate] windowWillClose:notif]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} //#include - (void)printPanel { -- cgit v1.2.3