diff options
-rw-r--r-- | xbmc/ServiceManager.cpp | 3 | ||||
-rw-r--r-- | xbmc/peripherals/Peripherals.cpp | 4 | ||||
-rw-r--r-- | xbmc/peripherals/Peripherals.h | 10 | ||||
-rw-r--r-- | xbmc/peripherals/devices/PeripheralHID.cpp | 8 | ||||
-rw-r--r-- | xbmc/peripherals/devices/PeripheralJoystick.cpp | 3 | ||||
-rw-r--r-- | xbmc/peripherals/devices/PeripheralJoystickEmulation.cpp | 6 |
6 files changed, 22 insertions, 12 deletions
diff --git a/xbmc/ServiceManager.cpp b/xbmc/ServiceManager.cpp index 4df77aa5d9..bb8988737e 100644 --- a/xbmc/ServiceManager.cpp +++ b/xbmc/ServiceManager.cpp @@ -139,7 +139,8 @@ bool CServiceManager::InitStageTwo(const CAppParamParser ¶ms) m_inputManager.reset(new CInputManager(params)); m_inputManager->InitializeInputs(); - m_peripherals.reset(new PERIPHERALS::CPeripherals(*m_announcementManager)); + m_peripherals.reset(new PERIPHERALS::CPeripherals(*m_announcementManager, + *m_inputManager)); m_gameRenderManager.reset(new RETRO::CGUIGameRenderManager); diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index d42478165d..696e60f12a 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -77,8 +77,10 @@ using namespace PERIPHERALS; using namespace XFILE; using namespace KODI::MESSAGING; -CPeripherals::CPeripherals(ANNOUNCEMENT::CAnnouncementManager &announcements) : +CPeripherals::CPeripherals(ANNOUNCEMENT::CAnnouncementManager &announcements, + CInputManager &inputManager) : m_announcements(announcements), + m_inputManager(inputManager), m_eventScanner(this) { // Register settings diff --git a/xbmc/peripherals/Peripherals.h b/xbmc/peripherals/Peripherals.h index a34cf33f82..2dc1c93b73 100644 --- a/xbmc/peripherals/Peripherals.h +++ b/xbmc/peripherals/Peripherals.h @@ -33,6 +33,7 @@ #include "utils/Observer.h" class CFileItemList; +class CInputManager; class CSetting; class CSettingsCategory; class TiXmlElement; @@ -61,7 +62,8 @@ namespace PERIPHERALS public ANNOUNCEMENT::IAnnouncer { public: - explicit CPeripherals(ANNOUNCEMENT::CAnnouncementManager &announcements); + explicit CPeripherals(ANNOUNCEMENT::CAnnouncementManager &announcements, + CInputManager &inputManager); ~CPeripherals() override; @@ -313,6 +315,11 @@ namespace PERIPHERALS // implementation of IAnnouncer void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data) override; + /*! + * \brief Access the input manager passed to the constructor + */ + CInputManager &GetInputManager() { return m_inputManager; } + private: bool LoadMappings(); bool GetMappingForDevice(const CPeripheralBus &bus, PeripheralScanResult& result) const; @@ -322,6 +329,7 @@ namespace PERIPHERALS // Construction parameters ANNOUNCEMENT::CAnnouncementManager &m_announcements; + CInputManager &m_inputManager; #if !defined(HAVE_LIBCEC) bool m_bMissingLibCecWarningDisplayed = false; diff --git a/xbmc/peripherals/devices/PeripheralHID.cpp b/xbmc/peripherals/devices/PeripheralHID.cpp index 7636978a56..e86b0ff0b7 100644 --- a/xbmc/peripherals/devices/PeripheralHID.cpp +++ b/xbmc/peripherals/devices/PeripheralHID.cpp @@ -22,7 +22,7 @@ #include "utils/log.h" #include "guilib/LocalizeStrings.h" #include "input/InputManager.h" -#include "ServiceBroker.h" +#include "peripherals/Peripherals.h" using namespace PERIPHERALS; @@ -38,7 +38,7 @@ CPeripheralHID::~CPeripheralHID(void) if (!m_strKeymap.empty() && !GetSettingBool("do_not_use_custom_keymap")) { CLog::Log(LOGDEBUG, "%s - switching active keymapping to: default", __FUNCTION__); - CServiceBroker::GetInputManager().RemoveKeymap(m_strKeymap); + m_manager.GetInputManager().RemoveKeymap(m_strKeymap); } } @@ -66,12 +66,12 @@ bool CPeripheralHID::InitialiseFeature(const PeripheralFeature feature) if (bKeymapEnabled) { CLog::Log(LOGDEBUG, "%s - adding keymapping for: %s", __FUNCTION__, m_strKeymap.c_str()); - CServiceBroker::GetInputManager().AddKeymap(m_strKeymap); + m_manager.GetInputManager().AddKeymap(m_strKeymap); } else if (!bKeymapEnabled) { CLog::Log(LOGDEBUG, "%s - removing keymapping for: %s", __FUNCTION__, m_strKeymap.c_str()); - CServiceBroker::GetInputManager().RemoveKeymap(m_strKeymap); + m_manager.GetInputManager().RemoveKeymap(m_strKeymap); } } diff --git a/xbmc/peripherals/devices/PeripheralJoystick.cpp b/xbmc/peripherals/devices/PeripheralJoystick.cpp index 58f03b5280..e23f4be20e 100644 --- a/xbmc/peripherals/devices/PeripheralJoystick.cpp +++ b/xbmc/peripherals/devices/PeripheralJoystick.cpp @@ -34,7 +34,6 @@ #include "threads/SingleLock.h" #include "utils/log.h" #include "Application.h" -#include "ServiceBroker.h" #include <algorithm> @@ -93,7 +92,7 @@ bool CPeripheralJoystick::InitialiseFeature(const PeripheralFeature feature) InitializeDeadzoneFiltering(); // Give joystick monitor priority over default controller - m_appInput.reset(new CKeymapHandling(this, false, CServiceBroker::GetInputManager().KeymapEnvironment())); + m_appInput.reset(new CKeymapHandling(this, false, m_manager.GetInputManager().KeymapEnvironment())); m_joystickMonitor.reset(new CJoystickMonitor); RegisterInputHandler(m_joystickMonitor.get(), false); } diff --git a/xbmc/peripherals/devices/PeripheralJoystickEmulation.cpp b/xbmc/peripherals/devices/PeripheralJoystickEmulation.cpp index dbed666b6c..fa9080809d 100644 --- a/xbmc/peripherals/devices/PeripheralJoystickEmulation.cpp +++ b/xbmc/peripherals/devices/PeripheralJoystickEmulation.cpp @@ -21,8 +21,8 @@ #include "PeripheralJoystickEmulation.h" #include "input/keyboard/generic/JoystickEmulation.h" #include "input/InputManager.h" +#include "peripherals/Peripherals.h" #include "threads/SingleLock.h" -#include "ServiceBroker.h" #include <algorithm> #include <sstream> @@ -38,7 +38,7 @@ CPeripheralJoystickEmulation::CPeripheralJoystickEmulation(CPeripherals& manager CPeripheralJoystickEmulation::~CPeripheralJoystickEmulation(void) { - CServiceBroker::GetInputManager().UnregisterKeyboardHandler(this); + m_manager.GetInputManager().UnregisterKeyboardHandler(this); } bool CPeripheralJoystickEmulation::InitialiseFeature(const PeripheralFeature feature) @@ -49,7 +49,7 @@ bool CPeripheralJoystickEmulation::InitialiseFeature(const PeripheralFeature fea { if (feature == FEATURE_JOYSTICK) { - CServiceBroker::GetInputManager().RegisterKeyboardHandler(this); + m_manager.GetInputManager().RegisterKeyboardHandler(this); } bSuccess = true; } |