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:
authorDamien Plisson <damien.plisson@yahoo.fr>2009-10-20 19:23:04 +0400
committerDamien Plisson <damien.plisson@yahoo.fr>2009-10-20 19:23:04 +0400
commit5571d37e94a2989ea0dd727abb43887a95f585f3 (patch)
treefc8f1261b02420067d9c1f422bea2d27d79c26b5 /intern
parent4197253b26dd86b1c06f400542fd073340f644a0 (diff)
Cocoa:
- fix windowDidResize event not forwarded in some cases on 10.6 - fix crash on repeated Cmd-Q + Cancel quit actions - place stub for .blend drop on blender app icon
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm21
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm4
2 files changed, 20 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index f8e124991af..3b2c5ea76a3 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -525,7 +525,8 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG]) {
@interface CocoaAppDelegate : NSObject {
GHOST_SystemCocoa *systemCocoa;
}
--(void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;
+- (void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
- (void)applicationWillTerminate:(NSNotification *)aNotification;
@end
@@ -536,6 +537,12 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG]) {
systemCocoa = sysCocoa;
}
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+ NSLog(@"\nGet open file event from cocoa : %@",filename);
+ return YES;
+}
+
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
//TODO: implement graceful termination through Cocoa mechanism to avoid session log off to be cancelled
@@ -658,13 +665,14 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
[NSApp setWindowsMenu:windowMenu];
[windowMenu release];
}
- [NSApp finishLaunching];
}
if ([NSApp delegate] == nil) {
CocoaAppDelegate *appDelegate = [[CocoaAppDelegate alloc] init];
[appDelegate setSystemCocoa:this];
[NSApp setDelegate:appDelegate];
}
+
+ [NSApp finishLaunching];
[pool drain];
}
@@ -995,7 +1003,7 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
GHOST_Window* window = (GHOST_Window*)m_windowManager->getActiveWindow();
//Discard quit event if we are in cursor grab sequence
- if ((window->getCursorGrabMode() != GHOST_kGrabDisable) && (window->getCursorGrabMode() != GHOST_kGrabNormal))
+ if (window && (window->getCursorGrabMode() != GHOST_kGrabDisable) && (window->getCursorGrabMode() != GHOST_kGrabNormal))
return GHOST_kExitCancel;
//Check open windows if some changes are not saved
@@ -1007,7 +1015,14 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
{
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) );
return GHOST_kExitNow;
+ } else {
+ //Give back focus to the blender window if user selected cancel quit
+ NSArray *windowsList = [NSApp orderedWindows];
+ if ([windowsList count]) {
+ [[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
+ }
}
+
}
else {
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) );
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 197b2de1f32..b9a598cb265 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -115,12 +115,12 @@ extern "C" {
- (void)windowDidResize:(NSNotification *)notification
{
#ifdef MAC_OS_X_VERSION_10_6
- if (![[notification object] inLiveResize]) {
+ //if (![[notification object] inLiveResize]) {
//Send event only once, at end of resize operation (when user has released mouse button)
#endif
systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow);
#ifdef MAC_OS_X_VERSION_10_6
- }
+ //}
#endif
/* Live resize ugly patch. Needed because live resize runs in a modal loop, not letting main loop run
if ([[notification object] inLiveResize]) {