Fix #28265: blender 2.59 not starting on OS X with old ndof driver.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 17 Aug 2011 15:01:26 +0000 (15:01 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 17 Aug 2011 15:01:26 +0000 (15:01 +0000)
Patch by Jens Verwiebe.

intern/ghost/intern/GHOST_NDOFManagerCocoa.h
intern/ghost/intern/GHOST_NDOFManagerCocoa.mm

index e9897f30104c2122ae84de83f3c28dee395b0011..5e85808b5a6d051da85c9cc6911b00cd563a4805 100644 (file)
@@ -43,6 +43,7 @@ public:
        // whether multi-axis functionality is available (via the OS or driver)
        // does not imply that a device is plugged in or being used
        bool available();
+       bool oldDRV();
 
 private:
        unsigned short m_clientID;
index 409ed953134b517286d2666517da8849bb7349e1..f665f5f6b39084e4ce859235227f8e7312beda31 100644 (file)
@@ -143,7 +143,7 @@ GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa(GHOST_System& sys)
 
                // printf("ndof: client id = %d\n", m_clientID);
 
-               if (SetConnexionClientButtonMask != NULL) {
+               if (oldDRV()) {
                        has_old_driver = false;
                        SetConnexionClientButtonMask(m_clientID, kConnexionMaskAllButtons);
                }
@@ -176,5 +176,14 @@ extern "C" {
                return InstallConnexionHandlers != NULL;
                // this means that the driver is installed and dynamically linked to blender
        }
+
+       bool GHOST_NDOFManagerCocoa::oldDRV()
+       {
+               extern OSErr SetConnexionClientButtonMask() __attribute__((weak_import));
+               // Make the linker happy for the framework check (see link below for more info)
+               // http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html
+               return SetConnexionClientButtonMask != NULL;
+               // this means that the driver has this symbol
+       }
 }
 #endif // WITH_INPUT_NDOF