]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/joystick.cpp
iconv() really never set the trailing 0.
[wxWidgets.git] / src / gtk1 / joystick.cpp
index 3b80491d4c5dbfe779579ca138b6dd62e29978b6..e53af61ccf66cf1284ec599f929d8c38af54c5a8 100644 (file)
 #pragma implementation "joystick.h"
 #endif
 
+#include "wx/defs.h"
+
+#if wxUSE_JOYSTICK
+
+#include "wx/joystick.h"
+
 #include <linux/joystick.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -20,9 +26,9 @@
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <unistd.h>
+
 #include "wx/event.h"
 #include "wx/window.h"
-#include "wx/gtk/joystick.h"
 
 #define JOYSTICK_AXE_MAX 32767
 #define JOYSTICK_AXE_MIN -32767
@@ -33,9 +39,9 @@ wxJoystick::wxJoystick(int joystick)
 {
   wxString dev_name;
   // Assume it's the same device name on all Linux systems ...
-  dev_name.Printf("/dev/js%d", (joystick == wxJOYSTICK1) ? 0 : 1);
+  dev_name.Printf( wxT("/dev/js%d"), (joystick == wxJOYSTICK1) ? 0 : 1);  // FIXME Unicode?
 
-  m_joystick = open(dev_name, O_RDWR);
+  m_joystick = open(dev_name.fn_str(), O_RDWR);
   m_lastposition = wxPoint(-1, -1);
   for (int i=0;i<15;i++)
     m_axe[i] = 0;
@@ -180,8 +186,8 @@ int wxJoystick::GetNumberJoysticks(void) const
   int fd, j;
 
   for (j=0;j<2;j++) {
-    dev_name.Printf("/dev/js%d", j);
-    fd = open(dev_name, O_RDONLY);
+    dev_name.Printf(wxT("/dev/js%d"), j);
+    fd = open(dev_name.fn_str(), O_RDONLY);
     if (fd == -1)
       return j;
     close(fd);
@@ -341,7 +347,7 @@ bool wxJoystick::HasPOVCTS(void) const
 // Operations
 ////////////////////////////////////////////////////////////////////////////
 
-bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq = 0)
+bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq)
 {
   m_catchwin = win;
   m_polling = pollingFreq;
@@ -354,4 +360,5 @@ bool wxJoystick::ReleaseCapture(void)
   m_polling = 0;
   return TRUE;
 }
+#endif  // wxUSE_JOYSTICK