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
diff options
context:
space:
mode:
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm25
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h2
2 files changed, 22 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 71465822bee..e9d34534fcf 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -374,6 +374,25 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar)
}
+#pragma mark defines for 10.6 api not documented in 10.5
+#ifndef MAC_OS_X_VERSION_10_6
+
+@interface NSEvent(SnowLeopardEvents)
+/* modifier keys currently down. This returns the state of devices combined
+ with synthesized events at the moment, independent of which events
+ have been delivered via the event stream. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
++ (unsigned int)modifierFlags; //NSUInteger is defined only from 10.5
+#else
++ (NSUInteger)modifierFlags;
+#endif
+@end
+
+#endif
+
+
+#pragma mark Utility functions
+
#define FIRSTFILEBUFLG 512
static bool g_hasFirstFile = false;
static char g_firstFileBuf[512];
@@ -883,11 +902,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent()
#else
//If build against an older SDK, check if running on 10.6 to use the correct function
if ([NSEvent respondsToSelector:@selector(modifierFlags)]) {
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
- modifiers = (unsigned int)[NSEvent modifierFlags];
-#else
- modifiers = (NSUInteger)[NSEvent modifierFlags];
-#endif
+ modifiers = [NSEvent modifierFlags];
}
else {
//TODO: need to find a better workaround for the missing cocoa "getModifierFlag" function in 10.4/10.5
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index c052af775f2..77015876290 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -97,7 +97,9 @@
/* some math and copy defines */
+#ifndef SWAP
#define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }
+#endif
#define ABS(a) ( (a)<0 ? (-(a)) : (a) )