FIX: Enable Hat handling in Application::ProcessJoystick
authorChris "Koying" Browet <cbro@semperpax.com>
Fri, 1 Nov 2013 14:02:12 +0000 (15:02 +0100)
committerdavilla <davilla@4pi.com>
Fri, 1 Nov 2013 20:29:28 +0000 (16:29 -0400)
xbmc/Application.cpp
xbmc/Application.h
xbmc/windowing/osx/WinEventsIOS.mm

index e1465df..955df80 100644 (file)
@@ -3094,7 +3094,7 @@ bool CApplication::ProcessEventServer(float frameTime)
           m_lastAxisMap[joystickName].erase(wKeyID);
       }
 
-      return ProcessJoystickEvent(joystickName, wKeyID, isAxis, fAmount);
+      return ProcessJoystickEvent(joystickName, wKeyID, isAxis ? JACTIVE_AXIS : JACTIVE_BUTTON, fAmount);
     }
     else
     {
@@ -3138,7 +3138,7 @@ bool CApplication::ProcessEventServer(float frameTime)
     for (map<std::string, map<int, float> >::iterator iter = m_lastAxisMap.begin(); iter != m_lastAxisMap.end(); ++iter)
     {
       for (map<int, float>::iterator iterAxis = (*iter).second.begin(); iterAxis != (*iter).second.end(); ++iterAxis)
-        ProcessJoystickEvent((*iter).first, (*iterAxis).first, true, (*iterAxis).second);
+        ProcessJoystickEvent((*iter).first, (*iterAxis).first, JACTIVE_AXIS, (*iterAxis).second);
     }
   }
 
@@ -3162,7 +3162,7 @@ bool CApplication::ProcessEventServer(float frameTime)
   return false;
 }
 
-bool CApplication::ProcessJoystickEvent(const std::string& joystickName, int wKeyID, bool isAxis, float fAmount, unsigned int holdTime /*=0*/)
+bool CApplication::ProcessJoystickEvent(const std::string& joystickName, int wKeyID, short inputType, float fAmount, unsigned int holdTime /*=0*/)
 {
 #if defined(HAS_EVENT_SERVER)
   m_idleTimer.StartZero();
@@ -3183,7 +3183,7 @@ bool CApplication::ProcessJoystickEvent(const std::string& joystickName, int wKe
    bool fullRange = false;
 
    // Translate using regular joystick translator.
-   if (CButtonTranslator::GetInstance().TranslateJoystickString(iWin, joystickName.c_str(), wKeyID, isAxis ? JACTIVE_AXIS : JACTIVE_BUTTON, actionID, actionName, fullRange))
+   if (CButtonTranslator::GetInstance().TranslateJoystickString(iWin, joystickName.c_str(), wKeyID, inputType, actionID, actionName, fullRange))
      return ExecuteInputAction( CAction(actionID, fAmount, 0.0f, actionName, holdTime) );
    else
      CLog::Log(LOGDEBUG, "ERROR mapping joystick action. Joystick: %s %i",joystickName.c_str(), wKeyID);
index 53b3dec..f90446c 100644 (file)
@@ -445,7 +445,7 @@ protected:
   bool ProcessGamepad(float frameTime);
   bool ProcessEventServer(float frameTime);
   bool ProcessPeripherals(float frameTime);
-  bool ProcessJoystickEvent(const std::string& joystickName, int button, bool isAxis, float fAmount, unsigned int holdTime = 0);
+  bool ProcessJoystickEvent(const std::string& joystickName, int button, short inputType, float fAmount, unsigned int holdTime = 0);
   bool ExecuteInputAction(const CAction &action);
   int  GetActiveWindowID(void);
 
index f79757b..179e91a 100644 (file)
@@ -22,6 +22,7 @@
 #include <list>
 #include "WinEventsIOS.h"
 #include "input/XBMC_vkeys.h"
+#include "input/SDLJoystick.h"
 #include "Application.h"
 #include "windowing/WindowingFactory.h"
 #include "threads/CriticalSection.h"
@@ -64,13 +65,12 @@ bool CWinEventsIOS::MessagePump()
       // the jbutton.which will be the keyID to translate using joystick.AppleRemote.xml
       // jbutton.holdTime is the time the button is hold in ms (for repeated keypresses)
       std::string joystickName = "AppleRemote";
-      bool isAxis = false;
       float fAmount = 1.0;
       unsigned char wKeyID = pumpEvent.jbutton.which;
       unsigned int holdTime = pumpEvent.jbutton.holdTime;
 
       CLog::Log(LOGDEBUG,"CWinEventsIOS: Button press keyID = %i", wKeyID);
-      ret |= g_application.ProcessJoystickEvent(joystickName, wKeyID, isAxis, fAmount, holdTime);
+      ret |= g_application.ProcessJoystickEvent(joystickName, wKeyID, JACTIVE_BUTTON, fAmount, holdTime);
     }
     else
       ret |= g_application.OnEvent(pumpEvent);