File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -346,6 +346,7 @@ - (void)drawRect:(NSRect)rect;
346346- (void )windowDidResize : (NSNotification *)notification ;
347347- (View*)initWithFrame : (NSRect )rect ;
348348- (void )setCanvas : (PyObject*)newCanvas ;
349+ - (void )windowWillClose : (NSNotification *)notification ;
349350- (BOOL )windowShouldClose : (NSNotification *)notification ;
350351- (BOOL )isFlipped ;
351352- (void )mouseEntered : (NSEvent *)event ;
@@ -4935,6 +4936,20 @@ - (void)windowDidResize: (NSNotification*)notification
49354936 [self setNeedsDisplay: YES ];
49364937}
49374938
4939+ - (void )windowWillClose : (NSNotification *)notification
4940+ {
4941+ PyGILState_STATE gstate;
4942+ PyObject* result;
4943+
4944+ gstate = PyGILState_Ensure ();
4945+ result = PyObject_CallMethod (canvas, " close_event" , " " );
4946+ if (result)
4947+ Py_DECREF (result);
4948+ else
4949+ PyErr_Print ();
4950+ PyGILState_Release (gstate);
4951+ }
4952+
49384953- (BOOL )windowShouldClose : (NSNotification *)notification
49394954{
49404955 NSWindow * window = [self window ];
You can’t perform that action at this time.
0 commit comments