X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/17a1ebd101f0653e69736416a2a28d0ada423141..e319bb30f7e88242f56144fcc279b57047566a6b:/src/unix/joystick.cpp diff --git a/src/unix/joystick.cpp b/src/unix/joystick.cpp index fcb266cc1d..64afa78cb9 100644 --- a/src/unix/joystick.cpp +++ b/src/unix/joystick.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: joystick.cpp +// Name: src/unix/joystick.cpp // Purpose: wxJoystick class // Author: Ported to Linux by Guilhem Lavaux // Modified by: @@ -12,12 +12,15 @@ // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/defs.h" - #if wxUSE_JOYSTICK #include "wx/joystick.h" +#ifndef WX_PRECOMP + #include "wx/event.h" + #include "wx/window.h" +#endif //WX_PRECOMP + #include #include #include @@ -26,8 +29,10 @@ #include #include -#include "wx/event.h" -#include "wx/window.h" +#ifdef HAVE_SYS_SELECT_H +# include +#endif + #include "wx/unix/private.h" enum { @@ -188,7 +193,7 @@ wxJoystick::wxJoystick(int joystick) if (m_device == -1) { dev_name.Printf( wxT("/dev/input/js%d"), joystick); - m_device = open(dev_name.fn_str(), O_RDONLY); + m_device = open(dev_name.fn_str(), O_RDONLY); } if (m_device != -1) @@ -283,7 +288,7 @@ bool wxJoystick::IsOk() const return (m_device != -1); } -int wxJoystick::GetNumberJoysticks() const +int wxJoystick::GetNumberJoysticks() { wxString dev_name; int fd, j; @@ -295,7 +300,7 @@ int wxJoystick::GetNumberJoysticks() const break; close(fd); } - + if (j == 0) { for (j=0; j<4; j++) { dev_name.Printf(wxT("/dev/input/js%d"), j); @@ -305,7 +310,7 @@ int wxJoystick::GetNumberJoysticks() const close(fd); } } - + return j; } @@ -489,4 +494,3 @@ bool wxJoystick::ReleaseCapture() return false; } #endif // wxUSE_JOYSTICK -