summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das@noemail.net>2009-08-24 00:55:08 (GMT)
committerdas <das@noemail.net>2009-08-24 00:55:08 (GMT)
commit86ec19a56f40015780d3c77e317496d283bb4d2f (patch)
tree814cc84017c4d8ab0299eb4eeef5973e3d6552ee /macosx
parent4159f67494d76704ac8932bc4253d59668108ce5 (diff)
downloadtk-86ec19a56f40015780d3c77e317496d283bb4d2f.zip
tk-86ec19a56f40015780d3c77e317496d283bb4d2f.tar.gz
tk-86ec19a56f40015780d3c77e317496d283bb4d2f.tar.bz2
* macosx/tkMacOSXWindowEvent.c: Allow WM_DELETE_WINDOW handlers to
prevent window closure by generating WM destroy event earlier (from window delegate's -windowShouldClose:). [Bug 2821084] FossilOrigin-Name: 34c767347fc6dae061903e23e48a56331f250cfe
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXWindowEvent.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 91fed49..3e98ced 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.37 2009/07/06 20:29:21 dkf Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.38 2009/08/24 00:55:08 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -154,17 +154,23 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
}
}
-- (void) windowClosed: (NSNotification *) notification
+- (BOOL) windowShouldClose: (NSWindow *) w
{
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
- TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
+ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, w);
#endif
- NSWindow *w = [notification object];
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
if (winPtr) {
TkGenWMDestroyEvent((Tk_Window) winPtr);
}
+
+ /*
+ * If necessary, TkGenWMDestroyEvent() handles [close]ing the window,
+ * so can always return NO from -windowShouldClose: for a Tk window.
+ */
+
+ return (winPtr ? NO : YES);
}
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
@@ -220,7 +226,6 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
observe(NSWindowDidResizeNotification, windowBoundsChanged:);
observe(NSWindowDidDeminiaturizeNotification, windowExpanded:);
observe(NSWindowDidMiniaturizeNotification, windowCollapsed:);
- observe(NSWindowWillCloseNotification, windowClosed:);
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
observe(NSWindowWillMoveNotification, windowDragStart:);
observe(NSWindowWillStartLiveResizeNotification, windowLiveResize:);