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
This commit is contained in:
@@ -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) );
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
Reference in New Issue
Block a user