]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/joystick.cpp
got rid of (unused since a long time) wxNO_3D and wxUSER_COLOURS
[wxWidgets.git] / src / gtk / joystick.cpp
index 9994f9a66706398e713a9a0a383ace1ee992b46f..710841201ad5f68b084d0cc5614939fb26879240 100644 (file)
@@ -6,17 +6,19 @@
 // Created:     05/23/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Guilhem Lavaux
-// Licence:    wxWindows license
+// Licence:    wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #pragma implementation "joystick.h"
 #endif
 
-#include <wx/joystick.h>
+#include "wx/defs.h"
 
 #if wxUSE_JOYSTICK
 
+#include "wx/joystick.h"
+
 #include <linux/joystick.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -37,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;
@@ -137,12 +139,12 @@ int wxJoystick::GetButtonState(void) const
 
 int wxJoystick::GetPOVPosition(void) const
 {
-  return 0;
+  return -1;
 }
 
 int wxJoystick::GetPOVCTSPosition(void) const
 {
-  return 0;
+  return -1;
 }
 
 int wxJoystick::GetRudderPosition(void) const
@@ -184,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);
@@ -205,7 +207,11 @@ int wxJoystick::GetProductId(void) const
 
 wxString wxJoystick::GetProductName(void) const
 {
-  return wxT("");
+  wxString dev_name;
+  // 2002-08-20 johan@linkdata.se
+  // Return the device name in lieu of a better one
+  dev_name.Printf( wxT("/dev/js%d"), (m_joystick == wxJOYSTICK1) ? 0 : 1);  // FIXME Unicode?
+  return dev_name;
 }
 
 int wxJoystick::GetXMin(void) const
@@ -345,7 +351,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;