]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/core/hidjoystick.cpp
avoid setting initial position if it was not specified, broken in r70734
[wxWidgets.git] / src / osx / core / hidjoystick.cpp
index 637546c41458c247a4a867e0c3b5380e2c698c73..4a8273838eff7a49a9346d33f5f37c8aac4ad578 100644 (file)
@@ -1,10 +1,9 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/corefoundation/joystick.cpp
+// Name:        src/osx/core/joystick.cpp
 // Purpose:     wxJoystick class
 // Author:      Ryan Norton
 // Modified by:
 // Created:     2/13/2005
-// RCS-ID:      $Id$
 // Copyright:   (c) Ryan Norton
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -41,7 +40,7 @@
 #include "wx/thread.h"      //wxThread for polling thread/ wxCriticalSection
 
 //private headers
-#include "wx/mac/corefoundation/hid.h" //private mac hid stuff
+#include "wx/osx/core/hid.h" //private mac hid stuff
 
 //mac headers
 #include <CoreServices/CoreServices.h>
@@ -157,8 +156,7 @@ wxJoystick::wxJoystick(int joystick)
     }
     else
     {
-        delete m_hid;
-        m_hid = NULL;
+        wxDELETE(m_hid);
     }
 }
 
@@ -174,8 +172,7 @@ wxJoystick::~wxJoystick()
     if (m_thread)
         m_thread->Delete();  // It's detached so it will delete itself
 
-    if (m_hid)
-        delete m_hid;
+    delete m_hid;
 }
 
 //---------------------------------------------------------------------------
@@ -193,25 +190,25 @@ wxPoint wxJoystick::GetPosition() const
 int wxJoystick::GetZPosition() const
 {
     if (m_thread)
-        return m_thread->m_axe[wxJS_AXIS_Z];
+        return m_thread->m_axe[wxJS_AXIS_Z-wxJS_AXIS_X];
     return 0;
 }
 int wxJoystick::GetRudderPosition() const
 {
     if (m_thread)
-        return m_thread->m_axe[wxJS_AXIS_RUDDER];
+        return m_thread->m_axe[wxJS_AXIS_RUDDER-wxJS_AXIS_X];
     return 0;
 }
 int wxJoystick::GetUPosition() const
 {
     if (m_thread)
-        return m_thread->m_axe[wxJS_AXIS_U];
+        return m_thread->m_axe[wxJS_AXIS_U-wxJS_AXIS_X];
     return 0;
 }
 int wxJoystick::GetVPosition() const
 {
     if (m_thread)
-        return m_thread->m_axe[wxJS_AXIS_V];
+        return m_thread->m_axe[wxJS_AXIS_V-wxJS_AXIS_X];
     return 0;
 }
 
@@ -568,7 +565,7 @@ void wxHIDJoystick::BuildCookies(CFArrayRef Array)
 
     //
     // I wasted two hours of my life on this line :(
-    // accidently removed it during some source cleaning...
+    // accidentally removed it during some source cleaning...
     //
     MakeCookies(Array);
 
@@ -780,11 +777,11 @@ void* wxJoystickThread::Entry()
 //---------------------------------------------------------------------------
 // wxJoystickThread::HIDCallback (static)
 //
-// Callback for the native HID device when it recieves input.
+// Callback for the native HID device when it receives input.
 //
 // This is where the REAL dirty work gets done.
 //
-// 1) Loops through each event the queue has recieved
+// 1) Loops through each event the queue has received
 // 2) First, checks if the thread that is running the loop for
 //    the polling has ended - if so it breaks out
 // 3) Next, it checks if there was an error getting this event from
@@ -895,11 +892,11 @@ void* wxJoystickThread::Entry()
         wxevent.SetEventObject(pThis->m_catchwin);
 
         if (pThis->m_catchwin)
-            pThis->m_catchwin->AddPendingEvent(wxevent);
+            pThis->m_catchwin->GetEventHandler()->AddPendingEvent(wxevent);
 
         ret = (*m_hid->GetQueue())->getNextEvent(m_hid->GetQueue(),
                     &hidevent, bogustime, 0);
     }
 }
 
-#endif // wxUSE_JOYSTICK 
+#endif // wxUSE_JOYSTICK