diff options
| author | Manolo Gouy <Manolo> | 2011-10-30 17:23:42 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-10-30 17:23:42 +0000 |
| commit | 0cf73d4603dca847e8b08399ee6a9385ccf72781 (patch) | |
| tree | 93f65192fddd4f4973b7079e728c81ae01b8532f /src | |
| parent | c9345e7d01b1b10f36432d7a6b3e1369a6f775d2 (diff) | |
Mac OS: simpler processing of window closing events.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9161 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index c989b8848..143004ff2 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -930,7 +930,7 @@ void fl_open_callback(void (*cb)(const char *)) { - (void)windowDidBecomeMain:(NSNotification *)notif; - (void)windowDidDeminiaturize:(NSNotification *)notif; - (void)windowDidMiniaturize:(NSNotification *)notif; -- (void)windowWillClose:(NSNotification *)notif; +- (void)anyWindowWillClose:(NSNotification *)notif; - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; - (void)applicationDidBecomeActive:(NSNotification *)notify; - (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification; @@ -1017,7 +1017,7 @@ void fl_open_callback(void (*cb)(const char *)) { Fl::handle(FL_HIDE, window); fl_unlock_function(); } -- (void)windowWillClose:(NSNotification *)notif +- (void)anyWindowWillClose:(NSNotification *)notif { fl_lock_function(); if ([[notif object] isKeyWindow]) { @@ -1028,7 +1028,7 @@ void fl_open_callback(void (*cb)(const char *)) { w = Fl::next_window(w); } if (w) { - [(FLWindow*)Fl_X::i(w)->xid makeKeyAndOrderFront:nil]; + [(FLWindow*)Fl_X::i(w)->xid makeKeyWindow]; } } fl_unlock_function(); @@ -1290,6 +1290,10 @@ void fl_open_display() { if (![NSApp servicesMenu]) createAppleMenu(); fl_system_menu = [NSApp mainMenu]; main_screen_height = [[[NSScreen screens] objectAtIndex:0] frame].size.height; + [[NSNotificationCenter defaultCenter] addObserver:[NSApp delegate] + selector:@selector(anyWindowWillClose:) + name:NSWindowWillCloseNotification + object:nil]; } } @@ -2824,7 +2828,6 @@ void Fl_X::set_cursor(Fl_Cursor c) } - (void)showPanel; - (void)printPanel; -- (void)closePanel:(NSNotification *)notif; @end @implementation FLaboutItemTarget - (void)showPanel @@ -2836,15 +2839,6 @@ 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 <FL/Fl_PostScript.H> - (void)printPanel |
