Properly disable NDOF code when WITH_INPUT_NDOF is not define.
authorNathan Letwory <nathan@letworyinteractive.com>
Tue, 2 Aug 2011 10:20:47 +0000 (10:20 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Tue, 2 Aug 2011 10:20:47 +0000 (10:20 +0000)
intern/ghost/intern/GHOST_System.cpp
intern/ghost/intern/GHOST_System.h
intern/ghost/intern/GHOST_SystemCocoa.mm
intern/ghost/intern/GHOST_SystemWin32.cpp

index f601031f2b6df4a57476c500a64fc3ebc5ffd154..64c2c218a07d478723323a30cb67993c46cb9499 100644 (file)
@@ -202,10 +202,12 @@ bool GHOST_System::dispatchEvents()
 {
        bool handled = false;
 
+#ifdef WITH_INPUT_NDOF
        // NDOF Motion event is sent only once per dispatch, so do it now:
        if (m_ndofManager) {
                handled |= m_ndofManager->sendMotionEvent();
        }
+#endif
 
        if (m_eventManager) {
                handled |= m_eventManager->dispatchEvents();
@@ -319,10 +321,12 @@ GHOST_TSuccess GHOST_System::exit()
                delete m_eventManager;
                m_eventManager = 0;
        }
+#ifdef WITH_INPUT_NDOF
        if (m_ndofManager) {
                delete m_ndofManager;
                m_ndofManager = 0;
        }
+#endif
        return GHOST_kSuccess;
 }
 
index 9fb36292c2bad4a3284a7d60a486da359d61bf53..c1e70916be62c1c86472c2a7ad40e76af86674aa 100644 (file)
@@ -249,11 +249,13 @@ public:
         */
        virtual inline GHOST_WindowManager* getWindowManager() const;
 
+#ifdef WITH_INPUT_NDOF
        /**
         * Returns a pointer to our n-degree of freedeom manager.
         * @return A pointer to our n-degree of freedeom manager.
         */
        virtual inline GHOST_NDOFManager* getNDOFManager() const;
+#endif
 
        /**
         * Returns the state of all modifier keys.
@@ -318,8 +320,10 @@ protected:
        /** The event manager. */
        GHOST_EventManager* m_eventManager;
 
+#ifdef WITH_INPUT_NDOF
        /** The N-degree of freedom device manager */
        GHOST_NDOFManager* m_ndofManager;
+#endif
        
        /** Prints all the events. */
 #ifdef GHOST_DEBUG
@@ -345,10 +349,12 @@ inline GHOST_WindowManager* GHOST_System::getWindowManager() const
        return m_windowManager;
 }
 
+#ifdef WITH_INPUT_NDOF
 inline GHOST_NDOFManager* GHOST_System::getNDOFManager() const
 {
        return m_ndofManager;
 }
+#endif
 
 #endif // _GHOST_SYSTEM_H_
 
index 8f2df4c396dac0e7d64ac1f0fb0e7112fdc4a6f0..17f0f2d6ecde753edc0da85d9d9a3ce18ec1325f 100644 (file)
@@ -597,7 +597,9 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
     GHOST_TSuccess success = GHOST_System::init();
     if (success) {
 
+#ifdef WITH_INPUT_NDOF
                m_ndofManager = new GHOST_NDOFManagerCocoa(*this);
+#endif
 
                //ProcessSerialNumber psn;
                
index 1b43fa92bb26771d0d0d2567e5ec367c43da22c6..4af5643eb75f29f837fef9733a63051e7f67b6c0 100644 (file)
@@ -161,7 +161,9 @@ GHOST_SystemWin32::GHOST_SystemWin32()
        // Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32.
        OleInitialize(0);
 
+#ifdef WITH_INPUT_NDOF
        m_ndofManager = new GHOST_NDOFManagerWin32(*this);
+#endif
 }
 
 GHOST_SystemWin32::~GHOST_SystemWin32()
@@ -757,6 +759,7 @@ void GHOST_SystemWin32::processMinMaxInfo(MINMAXINFO * minmax)
        minmax->ptMinTrackSize.y=240;
 }
 
+#ifdef WITH_INPUT_NDOF
 bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
 {
        bool eventSent = false;
@@ -773,7 +776,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
                if (info.dwType == RIM_TYPEHID)
                        m_ndofManager->setDevice(info.hid.dwVendorId, info.hid.dwProductId);
                else
-            puts("<!> not a HID device... mouse/kb perhaps?");
+                   puts("<!> not a HID device... mouse/kb perhaps?");
 
                firstEvent = false;
                }
@@ -846,6 +849,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
                }
        return eventSent;
 }
+#endif // WITH_INPUT_NDOF
 
 LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
@@ -892,8 +896,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                                                }
                                                break;
                                        case RIM_TYPEHID:
+#ifdef WITH_INPUT_NDOF
                                                if (system->processNDOF(raw))
                                                        eventHandled = true;
+#endif
                                                break;
                                        }
                                break;