diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowCocoa.mm')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 44b3c5b2a81..ab313b06f66 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -23,6 +23,7 @@ * Contributor(s): Maarten Gribnau 05/2001 * Damien Plisson 10/2009 * Jason Wilkins 02/2014 + * Jens Verwiebe 10/2014 * * ***** END GPL LICENSE BLOCK ***** */ @@ -45,8 +46,6 @@ # include <Carbon/Carbon.h> #endif - - #include <sys/sysctl.h> #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 @@ -77,7 +76,6 @@ enum { - (void)windowDidChangeBackingProperties:(NSNotification *)notification; @end - @implementation CocoaWindowDelegate : NSObject - (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa { @@ -88,6 +86,8 @@ enum { - (void)windowDidBecomeKey:(NSNotification *)notification { systemCocoa->handleWindowEvent(GHOST_kEventWindowActivate, associatedWindow); + // work around for broken appswitching when combining cmd-tab and missioncontrol + [(NSWindow*)associatedWindow->getOSWindow() orderFrontRegardless]; } - (void)windowDidResignKey:(NSNotification *)notification @@ -171,6 +171,7 @@ enum { - (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa; - (GHOST_SystemCocoa*)systemCocoa; @end + @implementation CocoaWindow - (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa { @@ -261,8 +262,6 @@ enum { @end - - #pragma mark NSOpenGLView subclass //We need to subclass it in order to give Cocoa the feeling key events are trapped @interface CocoaOpenGLView : NSOpenGLView <NSTextInput> @@ -277,6 +276,7 @@ enum { } - (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa; @end + @implementation CocoaOpenGLView - (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa @@ -1326,7 +1326,16 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress) return GHOST_kSuccess; } - +static void postNotification() +{ + NSUserNotification *notification = [[NSUserNotification alloc] init]; + notification.title = @"Blender progress notification"; + notification.informativeText = @"Calculation is finished"; + notification.soundName = NSUserNotificationDefaultSoundName; + [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification]; + [notification release]; +} + GHOST_TSuccess GHOST_WindowCocoa::endProgressBar() { if (!m_progressBarVisible) return GHOST_kFailure; @@ -1346,12 +1355,7 @@ GHOST_TSuccess GHOST_WindowCocoa::endProgressBar() // If Blender is not frontmost window, a message pops up with sound, in any case an entry in notifications if ([NSUserNotificationCenter respondsToSelector:@selector(defaultUserNotificationCenter)]) { - NSUserNotification *notification = [[NSUserNotification alloc] init]; - notification.title = @"Blender progress notification"; - notification.informativeText = @"Calculation ended"; - notification.soundName = NSUserNotificationDefaultSoundName; - [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification]; - [notification release]; + postNotification(); } [dockIcon release]; @@ -1360,8 +1364,6 @@ GHOST_TSuccess GHOST_WindowCocoa::endProgressBar() return GHOST_kSuccess; } - - #pragma mark Cursor handling void GHOST_WindowCocoa::loadCursor(bool visible, GHOST_TStandardCursor cursor) const |