]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/joystick.cpp
Added wxRichTextTableBlock class to help with table UI operations
[wxWidgets.git] / src / unix / joystick.cpp
index 15f49db961bc7ddd115bfbad4fb4feefe480df07..cf9cc33b3e8cf8aa1062d64dd3f3ad7cdcd2f4c3 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Ported to Linux by Guilhem Lavaux
 // Modified by:
 // Created:     05/23/98
-// RCS-ID:      $Id$
 // Copyright:   (c) Guilhem Lavaux
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 #ifndef WX_PRECOMP
     #include "wx/event.h"
     #include "wx/window.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
+#include "wx/thread.h"
+
 #include <linux/joystick.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -100,7 +102,7 @@ void wxJoystickThread::SendEvent(wxEventType type, long ts, int change)
     jwx_event.SetEventObject(m_catchwin);
 
     if (m_catchwin)
-        m_catchwin->AddPendingEvent(jwx_event);
+        m_catchwin->GetEventHandler()->AddPendingEvent(jwx_event);
 }
 
 void* wxJoystickThread::Entry()
@@ -134,6 +136,14 @@ void* wxJoystickThread::Entry()
 
             if ((j_evt.type & JS_EVENT_AXIS) && (j_evt.number < wxJS_MAX_AXES))
             {
+                // Ignore invalid axis.
+                if ( j_evt.number >= wxJS_MAX_AXES )
+                {
+                    wxLogDebug(wxS("Invalid axis index %d in joystick message."),
+                               j_evt.number);
+                    continue;
+                }
+
                 if (   (m_axe[j_evt.number] + m_threshold < j_evt.value)
                     || (m_axe[j_evt.number] - m_threshold > j_evt.value) )
             {