diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 69cc9028e212c..9aadc6381f3fb 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -738,7 +738,7 @@ bool CApplication::Create() g_Mouse.Initialize(); g_Mouse.SetEnabled(CSettings::Get().GetBool("input.enablemouse")); - g_Keyboard.Initialize(); + CInputManager::Get().InitializeInputs(); #if defined(TARGET_DARWIN_OSX) // Configure and possible manually start the helper. diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp index bd958ca36c6de..a0e73e9df4ae6 100644 --- a/xbmc/input/InputManager.cpp +++ b/xbmc/input/InputManager.cpp @@ -58,7 +58,6 @@ #include "ButtonTranslator.h" #include "input/MouseStat.h" #include "peripherals/Peripherals.h" -#include "input/KeyboardStat.h" #include "XBMC_vkeys.h" #include "utils/log.h" #include "utils/StringUtils.h" @@ -88,8 +87,9 @@ void CInputManager::InitializeInputs() // Pass the mapping of axis to triggers to m_Joystick m_Joystick.Initialize(); #endif -} + m_Keyboard.Initialize(); +} void CInputManager::ReInitializeJoystick() { @@ -420,10 +420,10 @@ bool CInputManager::OnEvent(XBMC_Event& newEvent) switch (newEvent.type) { case XBMC_KEYDOWN: - OnKey(g_Keyboard.ProcessKeyDown(newEvent.key.keysym)); + OnKey(m_Keyboard.ProcessKeyDown(newEvent.key.keysym)); break; case XBMC_KEYUP: - g_Keyboard.ProcessKeyUp(); + m_Keyboard.ProcessKeyUp(); break; case XBMC_MOUSEBUTTONDOWN: case XBMC_MOUSEBUTTONUP: @@ -512,7 +512,7 @@ bool CInputManager::OnKey(const CKey& key) // allow some keys to be processed while the screensaver is active if (g_application.WakeUpScreenSaverAndDPMS(processKey) && !processKey) { - CLog::LogF(LOGDEBUG, "%s pressed, screen saver/dpms woken up", g_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str()); + CLog::LogF(LOGDEBUG, "%s pressed, screen saver/dpms woken up", m_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str()); return true; } @@ -596,7 +596,7 @@ bool CInputManager::OnKey(const CKey& key) } } - CLog::LogF(LOGDEBUG, "%s pressed, trying keyboard action %x", g_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str(), action.GetID()); + CLog::LogF(LOGDEBUG, "%s pressed, trying keyboard action %x", m_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str(), action.GetID()); if (g_application.OnAction(action)) return true; @@ -611,7 +611,7 @@ bool CInputManager::OnKey(const CKey& key) action = CButtonTranslator::GetInstance().GetAction(iWin, key); } if (!key.IsAnalogButton()) - CLog::LogF(LOGDEBUG, "%s pressed, action is %s", g_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str(), action.GetName().c_str()); + CLog::LogF(LOGDEBUG, "%s pressed, action is %s", m_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str(), action.GetName().c_str()); return ExecuteInputAction(action); } diff --git a/xbmc/input/InputManager.h b/xbmc/input/InputManager.h index 96f4da75c56fb..3d0967c82d3a5 100644 --- a/xbmc/input/InputManager.h +++ b/xbmc/input/InputManager.h @@ -29,6 +29,7 @@ #endif #include "windowing/XBMC_events.h" #include "guilib/Key.h" +#include "input/KeyboardStat.h" class CInputManager { @@ -141,6 +142,8 @@ class CInputManager */ bool ExecuteInputAction(const CAction &action); + CKeyboardStat m_Keyboard; + #ifdef HAS_EVENT_SERVER std::map > m_lastAxisMap; #endif diff --git a/xbmc/input/KeyboardStat.cpp b/xbmc/input/KeyboardStat.cpp index 75f726521c9ba..42bc50ffa64a9 100644 --- a/xbmc/input/KeyboardStat.cpp +++ b/xbmc/input/KeyboardStat.cpp @@ -35,7 +35,6 @@ using namespace std; using namespace PERIPHERALS; -CKeyboardStat g_Keyboard; CKeyboardStat::CKeyboardStat() { diff --git a/xbmc/input/KeyboardStat.h b/xbmc/input/KeyboardStat.h index 73af94323d4f5..13b9a63a30877 100644 --- a/xbmc/input/KeyboardStat.h +++ b/xbmc/input/KeyboardStat.h @@ -37,8 +37,11 @@ // but this allows for double/redundant or ambiguous mapping definition, e.g. // ASCII/unicode could be derived from scancodes, virtual keys, modifiers and/or other ASCII/unicode. +#include + #include "windowing/XBMC_events.h" #include "guilib/Key.h" +#include "input/XBMC_keyboard.h" class CKeyboardStat { @@ -60,6 +63,4 @@ class CKeyboardStat unsigned int m_lastKeyTime; }; -extern CKeyboardStat g_Keyboard; - #endif