diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 09:25:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 09:25:13 +0000 |
commit | e353c8eff2bef4b84c539d4c03dc7c0a5adf9f9b (patch) | |
tree | 7ac20f83cf66e65d9e27e7be128f2142324466d7 /xbmc/peripherals/devices/Peripheral.cpp | |
parent | Adding upstream version 2:20.4+dfsg. (diff) | |
download | kodi-upstream.tar.xz kodi-upstream.zip |
Adding upstream version 2:20.5+dfsg.upstream/2%20.5+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/peripherals/devices/Peripheral.cpp')
-rw-r--r-- | xbmc/peripherals/devices/Peripheral.cpp | 67 |
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); } } |