diff options
-rw-r--r-- | xbmc/peripherals/addons/AddonInputHandling.cpp | 59 | ||||
-rw-r--r-- | xbmc/peripherals/addons/AddonInputHandling.h | 8 |
2 files changed, 35 insertions, 32 deletions
diff --git a/xbmc/peripherals/addons/AddonInputHandling.cpp b/xbmc/peripherals/addons/AddonInputHandling.cpp index 644c33ea53..88921baa0b 100644 --- a/xbmc/peripherals/addons/AddonInputHandling.cpp +++ b/xbmc/peripherals/addons/AddonInputHandling.cpp @@ -40,14 +40,14 @@ CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, m_buttonMap.reset(new CAddonButtonMap(peripheral, addon, handler->ControllerID())); if (m_buttonMap->Load()) { - m_driverHandler.reset(new CInputHandling(handler, m_buttonMap.get())); + m_joystickDriverHandler = std::make_unique<CInputHandling>(handler, m_buttonMap.get()); if (receiver) { - m_inputReceiver.reset(new CDriverReceiving(receiver, m_buttonMap.get())); + m_joystickInputReceiver = std::make_unique<CDriverReceiving>(receiver, m_buttonMap.get()); // Interfaces are connected here because they share button map as a common resource - handler->SetInputReceiver(m_inputReceiver.get()); + handler->SetInputReceiver(m_joystickInputReceiver.get()); } } else @@ -72,7 +72,8 @@ CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, m_buttonMap.reset(new CAddonButtonMap(peripheral, addon, handler->ControllerID())); if (m_buttonMap->Load()) { - m_keyboardHandler.reset(new KEYBOARD::CKeyboardInputHandling(handler, m_buttonMap.get())); + m_keyboardDriverHandler = + std::make_unique<KEYBOARD::CKeyboardInputHandling>(handler, m_buttonMap.get()); } else { @@ -96,7 +97,8 @@ CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, m_buttonMap.reset(new CAddonButtonMap(peripheral, addon, handler->ControllerID())); if (m_buttonMap->Load()) { - m_mouseHandler.reset(new MOUSE::CMouseInputHandling(handler, m_buttonMap.get())); + m_mouseDriverHandler = + std::make_unique<MOUSE::CMouseInputHandling>(handler, m_buttonMap.get()); } else { @@ -107,24 +109,25 @@ CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, CAddonInputHandling::~CAddonInputHandling(void) { - m_driverHandler.reset(); - m_inputReceiver.reset(); - m_keyboardHandler.reset(); + m_joystickDriverHandler.reset(); + m_joystickInputReceiver.reset(); + m_keyboardDriverHandler.reset(); + m_mouseDriverHandler.reset(); m_buttonMap.reset(); } bool CAddonInputHandling::OnButtonMotion(unsigned int buttonIndex, bool bPressed) { - if (m_driverHandler) - return m_driverHandler->OnButtonMotion(buttonIndex, bPressed); + if (m_joystickDriverHandler) + return m_joystickDriverHandler->OnButtonMotion(buttonIndex, bPressed); return false; } bool CAddonInputHandling::OnHatMotion(unsigned int hatIndex, HAT_STATE state) { - if (m_driverHandler) - return m_driverHandler->OnHatMotion(hatIndex, state); + if (m_joystickDriverHandler) + return m_joystickDriverHandler->OnHatMotion(hatIndex, state); return false; } @@ -134,58 +137,58 @@ bool CAddonInputHandling::OnAxisMotion(unsigned int axisIndex, int center, unsigned int range) { - if (m_driverHandler) - return m_driverHandler->OnAxisMotion(axisIndex, position, center, range); + if (m_joystickDriverHandler) + return m_joystickDriverHandler->OnAxisMotion(axisIndex, position, center, range); return false; } void CAddonInputHandling::OnInputFrame(void) { - if (m_driverHandler) - m_driverHandler->OnInputFrame(); + if (m_joystickDriverHandler) + m_joystickDriverHandler->OnInputFrame(); } bool CAddonInputHandling::OnKeyPress(const CKey& key) { - if (m_keyboardHandler) - return m_keyboardHandler->OnKeyPress(key); + if (m_keyboardDriverHandler) + return m_keyboardDriverHandler->OnKeyPress(key); return false; } void CAddonInputHandling::OnKeyRelease(const CKey& key) { - if (m_keyboardHandler) - m_keyboardHandler->OnKeyRelease(key); + if (m_keyboardDriverHandler) + m_keyboardDriverHandler->OnKeyRelease(key); } bool CAddonInputHandling::OnPosition(int x, int y) { - if (m_mouseHandler) - return m_mouseHandler->OnPosition(x, y); + if (m_mouseDriverHandler) + return m_mouseDriverHandler->OnPosition(x, y); return false; } bool CAddonInputHandling::OnButtonPress(MOUSE::BUTTON_ID button) { - if (m_mouseHandler) - return m_mouseHandler->OnButtonPress(button); + if (m_mouseDriverHandler) + return m_mouseDriverHandler->OnButtonPress(button); return false; } void CAddonInputHandling::OnButtonRelease(MOUSE::BUTTON_ID button) { - if (m_mouseHandler) - m_mouseHandler->OnButtonRelease(button); + if (m_mouseDriverHandler) + m_mouseDriverHandler->OnButtonRelease(button); } bool CAddonInputHandling::SetRumbleState(const JOYSTICK::FeatureName& feature, float magnitude) { - if (m_inputReceiver) - return m_inputReceiver->SetRumbleState(feature, magnitude); + if (m_joystickInputReceiver) + return m_joystickInputReceiver->SetRumbleState(feature, magnitude); return false; } diff --git a/xbmc/peripherals/addons/AddonInputHandling.h b/xbmc/peripherals/addons/AddonInputHandling.h index 2a59162647..f4ee8b3fef 100644 --- a/xbmc/peripherals/addons/AddonInputHandling.h +++ b/xbmc/peripherals/addons/AddonInputHandling.h @@ -83,10 +83,10 @@ public: bool SetRumbleState(const KODI::JOYSTICK::FeatureName& feature, float magnitude) override; private: - std::unique_ptr<KODI::JOYSTICK::IDriverHandler> m_driverHandler; - std::unique_ptr<KODI::JOYSTICK::IInputReceiver> m_inputReceiver; - std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> m_keyboardHandler; - std::unique_ptr<KODI::MOUSE::IMouseDriverHandler> m_mouseHandler; + std::unique_ptr<KODI::JOYSTICK::IDriverHandler> m_joystickDriverHandler; + std::unique_ptr<KODI::JOYSTICK::IInputReceiver> m_joystickInputReceiver; + std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> m_keyboardDriverHandler; + std::unique_ptr<KODI::MOUSE::IMouseDriverHandler> m_mouseDriverHandler; std::unique_ptr<KODI::JOYSTICK::IButtonMap> m_buttonMap; }; } // namespace PERIPHERALS |