|
From: <md...@us...> - 2010-10-23 03:34:58
|
Revision: 8762
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8762&view=rev
Author: mdehoon
Date: 2010-10-23 03:34:52 +0000 (Sat, 23 Oct 2010)
Log Message:
-----------
Implement close_event in the Mac OS X native backend.
Modified Paths:
--------------
trunk/matplotlib/src/_macosx.m
Modified: trunk/matplotlib/src/_macosx.m
===================================================================
--- trunk/matplotlib/src/_macosx.m 2010-10-22 16:20:15 UTC (rev 8761)
+++ trunk/matplotlib/src/_macosx.m 2010-10-23 03:34:52 UTC (rev 8762)
@@ -346,6 +346,7 @@
- (void)windowDidResize:(NSNotification*)notification;
- (View*)initWithFrame:(NSRect)rect;
- (void)setCanvas: (PyObject*)newCanvas;
+- (void)windowWillClose:(NSNotification*)notification;
- (BOOL)windowShouldClose:(NSNotification*)notification;
- (BOOL)isFlipped;
- (void)mouseEntered:(NSEvent*)event;
@@ -4935,6 +4936,20 @@
[self setNeedsDisplay: YES];
}
+- (void)windowWillClose:(NSNotification*)notification
+{
+ PyGILState_STATE gstate;
+ PyObject* result;
+
+ gstate = PyGILState_Ensure();
+ result = PyObject_CallMethod(canvas, "close_event", "");
+ if(result)
+ Py_DECREF(result);
+ else
+ PyErr_Print();
+ PyGILState_Release(gstate);
+}
+
- (BOOL)windowShouldClose:(NSNotification*)notification
{
NSWindow* window = [self window];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|