Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-12-21 15:56:02 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-12-21 15:56:02 +0400
commitb5054896c3e54c311ccd47f9f7ba254240cc87af (patch)
tree86ffe27aebfeda5bcdfcc36b2baa4232a4b1193f /intern
parent74ea6d93da5c72616c15f756702fcde68ce0eec1 (diff)
Fix #33644: rendering to a new window and then closing it would not completely
remove it, but still stick around listed in the Window menu. Fixed by removing the setReleasedWhenClosed:NO hack and using the proper cocoa window delegate mechanism.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm24
1 files changed, 9 insertions, 15 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 9f738c345f4..471505538ba 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -67,13 +67,13 @@ extern "C" {
}
- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa;
-- (void)windowWillClose:(NSNotification *)notification;
- (void)windowDidBecomeKey:(NSNotification *)notification;
- (void)windowDidResignKey:(NSNotification *)notification;
- (void)windowDidExpose:(NSNotification *)notification;
- (void)windowDidResize:(NSNotification *)notification;
- (void)windowDidMove:(NSNotification *)notification;
- (void)windowWillMove:(NSNotification *)notification;
+- (BOOL)windowShouldClose:(id)sender;
@end
@implementation CocoaWindowDelegate : NSObject
@@ -83,11 +83,6 @@ extern "C" {
associatedWindow = winCocoa;
}
-- (void)windowWillClose:(NSNotification *)notification
-{
- systemCocoa->handleWindowEvent(GHOST_kEventWindowClose, associatedWindow);
-}
-
- (void)windowDidBecomeKey:(NSNotification *)notification
{
systemCocoa->handleWindowEvent(GHOST_kEventWindowActivate, associatedWindow);
@@ -132,6 +127,14 @@ extern "C" {
wm_draw_update(ghostC);
}*/
}
+
+- (BOOL)windowShouldClose:(id)sender;
+{
+ //Let Blender close the window rather than closing immediately
+ systemCocoa->handleWindowEvent(GHOST_kEventWindowClose, associatedWindow);
+ return false;
+}
+
@end
#pragma mark NSWindow subclass
@@ -571,8 +574,6 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
[m_window setContentView:m_openGLView];
[m_window setInitialFirstResponder:m_openGLView];
- [m_window setReleasedWhenClosed:NO]; //To avoid bad pointer exception in case of user closing the window
-
[m_window makeKeyAndOrderFront:nil];
setDrawingContextType(type);
@@ -616,11 +617,6 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa()
[m_openGLView release];
if (m_window) {
- // previously we called [m_window release], but on 10.8 this does not
- // remove the window from [NSApp orderedWindows] and perhaps other
- // places, leading to crashes. so instead we set setReleasedWhenClosed
- // back to YES right before closing
- [m_window setReleasedWhenClosed:YES];
[m_window close];
}
@@ -955,7 +951,6 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
//Copy current window parameters
[tmpWindow setTitle:[m_window title]];
[tmpWindow setRepresentedFilename:[m_window representedFilename]];
- [tmpWindow setReleasedWhenClosed:NO];
[tmpWindow setAcceptsMouseMovedEvents:YES];
[tmpWindow setDelegate:[m_window delegate]];
[tmpWindow setSystemAndWindowCocoa:[m_window systemCocoa] windowCocoa:this];
@@ -1013,7 +1008,6 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
//Copy current window parameters
[tmpWindow setTitle:[m_window title]];
[tmpWindow setRepresentedFilename:[m_window representedFilename]];
- [tmpWindow setReleasedWhenClosed:NO];
[tmpWindow setAcceptsMouseMovedEvents:YES];
[tmpWindow setDelegate:[m_window delegate]];
[tmpWindow setSystemAndWindowCocoa:[m_window systemCocoa] windowCocoa:this];