summaryrefslogtreecommitdiffstats
path: root/xbmc/peripherals/devices/Peripheral.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--xbmc/peripherals/devices/Peripheral.cpp67
1 files changed, 12 insertions, 55 deletions
diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp
index 6c3f779..2c656a3 100644
--- a/xbmc/peripherals/devices/Peripheral.cpp
+++ b/xbmc/peripherals/devices/Peripheral.cpp
@@ -588,21 +588,10 @@ void CPeripheral::RegisterInputHandler(IInputHandler* handler, bool bPromiscuous
auto it = m_inputHandlers.find(handler);
if (it == m_inputHandlers.end())
{
- PeripheralAddonPtr addon = m_manager.GetAddonWithButtonMap(this);
- if (addon)
- {
- std::unique_ptr<CAddonInputHandling> addonInput = std::make_unique<CAddonInputHandling>(
- m_manager, this, std::move(addon), handler, GetDriverReceiver());
- if (addonInput->Load())
- {
- RegisterJoystickDriverHandler(addonInput.get(), bPromiscuous);
- m_inputHandlers[handler] = std::move(addonInput);
- }
- }
- else
- {
- CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", m_strLocation);
- }
+ CAddonInputHandling* addonInput =
+ new CAddonInputHandling(m_manager, this, handler, GetDriverReceiver());
+ RegisterJoystickDriverHandler(addonInput, bPromiscuous);
+ m_inputHandlers[handler].reset(addonInput);
}
}
@@ -624,26 +613,10 @@ void CPeripheral::RegisterKeyboardHandler(KEYBOARD::IKeyboardInputHandler* handl
auto it = m_keyboardHandlers.find(handler);
if (it == m_keyboardHandlers.end())
{
- std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> keyboardDriverHandler;
-
- PeripheralAddonPtr addon = m_manager.GetAddonWithButtonMap(this);
- if (addon)
- {
- std::unique_ptr<CAddonInputHandling> addonInput =
- std::make_unique<CAddonInputHandling>(m_manager, this, std::move(addon), handler);
- if (addonInput->Load())
- keyboardDriverHandler = std::move(addonInput);
- }
- else
- {
- CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", m_strLocation);
- }
-
- if (keyboardDriverHandler)
- {
- RegisterKeyboardDriverHandler(keyboardDriverHandler.get(), bPromiscuous);
- m_keyboardHandlers[handler] = std::move(keyboardDriverHandler);
- }
+ std::unique_ptr<CAddonInputHandling> addonInput(
+ new CAddonInputHandling(m_manager, this, handler));
+ RegisterKeyboardDriverHandler(addonInput.get(), bPromiscuous);
+ m_keyboardHandlers[handler] = std::move(addonInput);
}
}
@@ -662,26 +635,10 @@ void CPeripheral::RegisterMouseHandler(MOUSE::IMouseInputHandler* handler, bool
auto it = m_mouseHandlers.find(handler);
if (it == m_mouseHandlers.end())
{
- std::unique_ptr<KODI::MOUSE::IMouseDriverHandler> mouseDriverHandler;
-
- PeripheralAddonPtr addon = m_manager.GetAddonWithButtonMap(this);
- if (addon)
- {
- std::unique_ptr<CAddonInputHandling> addonInput =
- std::make_unique<CAddonInputHandling>(m_manager, this, std::move(addon), handler);
- if (addonInput->Load())
- mouseDriverHandler = std::move(addonInput);
- }
- else
- {
- CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", m_strLocation);
- }
-
- if (mouseDriverHandler)
- {
- RegisterMouseDriverHandler(mouseDriverHandler.get(), bPromiscuous);
- m_mouseHandlers[handler] = std::move(mouseDriverHandler);
- }
+ std::unique_ptr<CAddonInputHandling> addonInput(
+ new CAddonInputHandling(m_manager, this, handler));
+ RegisterMouseDriverHandler(addonInput.get(), bPromiscuous);
+ m_mouseHandlers[handler] = std::move(addonInput);
}
}