diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index b9db97a21238a..baf6cce74aea1 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -116,7 +116,6 @@ 18B7C7ED1294222E009E7A26 /* GUIWindowManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C7981294222E009E7A26 /* GUIWindowManager.cpp */; }; 18B7C7EE1294222E009E7A26 /* GUIWrappingListContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C7991294222E009E7A26 /* GUIWrappingListContainer.cpp */; }; 18B7C7EF1294222E009E7A26 /* IWindowManagerCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79A1294222E009E7A26 /* IWindowManagerCallback.cpp */; }; - 18B7C7F01294222E009E7A26 /* Key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79B1294222E009E7A26 /* Key.cpp */; }; 18B7C7F11294222E009E7A26 /* LocalizeStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79C1294222E009E7A26 /* LocalizeStrings.cpp */; }; 18B7C7F21294222E009E7A26 /* MatrixGLES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79D1294222E009E7A26 /* MatrixGLES.cpp */; }; 18B7C7F31294222E009E7A26 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79E1294222E009E7A26 /* Shader.cpp */; }; @@ -182,6 +181,9 @@ 3802709A13D5A653009493DD /* SystemClock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3802709813D5A653009493DD /* SystemClock.cpp */; }; 384718D81325BA04000486D6 /* XBDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 384718D61325BA04000486D6 /* XBDateTime.cpp */; }; 38F4E57013CCCB3B00664821 /* Implementation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F4E56C13CCCB3B00664821 /* Implementation.cpp */; }; + 395C29BC1A94733100EBC7AD /* Key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395C29BA1A94733100EBC7AD /* Key.cpp */; }; + 395C29BD1A94733100EBC7AD /* Key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395C29BA1A94733100EBC7AD /* Key.cpp */; }; + 395C29BE1A94733100EBC7AD /* Key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395C29BA1A94733100EBC7AD /* Key.cpp */; }; 395C29C11A98A0A000EBC7AD /* Webinterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395C29BF1A98A0A000EBC7AD /* Webinterface.cpp */; }; 395C29C21A98A0A000EBC7AD /* Webinterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395C29BF1A98A0A000EBC7AD /* Webinterface.cpp */; }; 395C29C31A98A0A000EBC7AD /* Webinterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395C29BF1A98A0A000EBC7AD /* Webinterface.cpp */; }; @@ -1452,7 +1454,6 @@ DFF0F2B817528350002DA3A4 /* imagefactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF404A3716B9896C00D8023E /* imagefactory.cpp */; }; DFF0F2B917528350002DA3A4 /* IWindowManagerCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79A1294222E009E7A26 /* IWindowManagerCallback.cpp */; }; DFF0F2BA17528350002DA3A4 /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; }; - DFF0F2BB17528350002DA3A4 /* Key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79B1294222E009E7A26 /* Key.cpp */; }; DFF0F2BC17528350002DA3A4 /* LocalizeStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79C1294222E009E7A26 /* LocalizeStrings.cpp */; }; DFF0F2BD17528350002DA3A4 /* MatrixGLES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79D1294222E009E7A26 /* MatrixGLES.cpp */; }; DFF0F2BE17528350002DA3A4 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79E1294222E009E7A26 /* Shader.cpp */; }; @@ -2704,7 +2705,6 @@ E4991321174E5DAD00741B6D /* imagefactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF404A3716B9896C00D8023E /* imagefactory.cpp */; }; E4991322174E5DAD00741B6D /* IWindowManagerCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79A1294222E009E7A26 /* IWindowManagerCallback.cpp */; }; E4991323174E5DAD00741B6D /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; }; - E4991324174E5DAD00741B6D /* Key.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79B1294222E009E7A26 /* Key.cpp */; }; E4991325174E5DAD00741B6D /* LocalizeStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79C1294222E009E7A26 /* LocalizeStrings.cpp */; }; E4991326174E5DAD00741B6D /* MatrixGLES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79D1294222E009E7A26 /* MatrixGLES.cpp */; }; E4991327174E5DAD00741B6D /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C79E1294222E009E7A26 /* Shader.cpp */; }; @@ -3459,7 +3459,6 @@ 18B7C7401294222D009E7A26 /* IAudioDeviceChangedCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IAudioDeviceChangedCallback.h; sourceTree = ""; }; 18B7C7411294222D009E7A26 /* IMsgTargetCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMsgTargetCallback.h; sourceTree = ""; }; 18B7C7421294222D009E7A26 /* IWindowManagerCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IWindowManagerCallback.h; sourceTree = ""; }; - 18B7C7431294222D009E7A26 /* Key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Key.h; sourceTree = ""; }; 18B7C7441294222D009E7A26 /* LocalizeStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizeStrings.h; sourceTree = ""; }; 18B7C7451294222E009E7A26 /* MatrixGLES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatrixGLES.h; sourceTree = ""; }; 18B7C7461294222E009E7A26 /* Resolution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Resolution.h; sourceTree = ""; }; @@ -3543,7 +3542,6 @@ 18B7C7981294222E009E7A26 /* GUIWindowManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowManager.cpp; sourceTree = ""; }; 18B7C7991294222E009E7A26 /* GUIWrappingListContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWrappingListContainer.cpp; sourceTree = ""; }; 18B7C79A1294222E009E7A26 /* IWindowManagerCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IWindowManagerCallback.cpp; sourceTree = ""; }; - 18B7C79B1294222E009E7A26 /* Key.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Key.cpp; sourceTree = ""; }; 18B7C79C1294222E009E7A26 /* LocalizeStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalizeStrings.cpp; sourceTree = ""; }; 18B7C79D1294222E009E7A26 /* MatrixGLES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MatrixGLES.cpp; sourceTree = ""; }; 18B7C79E1294222E009E7A26 /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shader.cpp; sourceTree = ""; }; @@ -3671,6 +3669,8 @@ 38F4E56C13CCCB3B00664821 /* Implementation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Implementation.cpp; sourceTree = ""; }; 38F4E56D13CCCB3B00664821 /* README.platform */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.platform; sourceTree = ""; }; 38F4E56E13CCCB3B00664821 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = ""; }; + 395C29BA1A94733100EBC7AD /* Key.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Key.cpp; sourceTree = ""; }; + 395C29BB1A94733100EBC7AD /* Key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Key.h; sourceTree = ""; }; 395C29BF1A98A0A000EBC7AD /* Webinterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Webinterface.cpp; sourceTree = ""; }; 395C29C01A98A0A000EBC7AD /* Webinterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Webinterface.h; sourceTree = ""; }; 395C29C41A98A0E100EBC7AD /* ILanguageInvoker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ILanguageInvoker.cpp; sourceTree = ""; }; @@ -6308,8 +6308,6 @@ 18B7C7421294222D009E7A26 /* IWindowManagerCallback.h */, 32C631261423A90F00F18420 /* JpegIO.cpp */, 32C631271423A90F00F18420 /* JpegIO.h */, - 18B7C79B1294222E009E7A26 /* Key.cpp */, - 18B7C7431294222D009E7A26 /* Key.h */, 18B7C79C1294222E009E7A26 /* LocalizeStrings.cpp */, 18B7C7441294222D009E7A26 /* LocalizeStrings.h */, 18B7C79D1294222E009E7A26 /* MatrixGLES.cpp */, @@ -6415,6 +6413,8 @@ DFAB049713F8376700B70BFB /* InertialScrollingHandler.h */, DF14CF7C1A77782E00396CC9 /* InputManager.cpp */, DF14CF7D1A77782E00396CC9 /* InputManager.h */, + 395C29BA1A94733100EBC7AD /* Key.cpp */, + 395C29BB1A94733100EBC7AD /* Key.h */, 7CF80DC719710DC2003B2B34 /* KeyboardLayout.cpp */, 7CF80DC819710DC2003B2B34 /* KeyboardLayout.h */, 18B7C8CD12942546009E7A26 /* KeyboardLayoutConfiguration.cpp */, @@ -10651,6 +10651,7 @@ E38E22490D25F9FE00618676 /* log.cpp in Sources */, E38E224B0D25F9FE00618676 /* match.cpp in Sources */, E38E224D0D25F9FE00618676 /* options.cpp in Sources */, + 395C29BC1A94733100EBC7AD /* Key.cpp in Sources */, E38E224E0D25F9FE00618676 /* pathfn.cpp in Sources */, 395C29F01A98A16300EBC7AD /* HTTPPythonWsgiInvoker.cpp in Sources */, E38E22500D25F9FE00618676 /* rarvm.cpp in Sources */, @@ -10970,7 +10971,6 @@ 18B7C7ED1294222E009E7A26 /* GUIWindowManager.cpp in Sources */, 18B7C7EE1294222E009E7A26 /* GUIWrappingListContainer.cpp in Sources */, 18B7C7EF1294222E009E7A26 /* IWindowManagerCallback.cpp in Sources */, - 18B7C7F01294222E009E7A26 /* Key.cpp in Sources */, 18B7C7F11294222E009E7A26 /* LocalizeStrings.cpp in Sources */, 18B7C7F21294222E009E7A26 /* MatrixGLES.cpp in Sources */, 18B7C7F31294222E009E7A26 /* Shader.cpp in Sources */, @@ -11935,7 +11935,6 @@ DFF0F2B817528350002DA3A4 /* imagefactory.cpp in Sources */, DFF0F2B917528350002DA3A4 /* IWindowManagerCallback.cpp in Sources */, DFF0F2BA17528350002DA3A4 /* JpegIO.cpp in Sources */, - DFF0F2BB17528350002DA3A4 /* Key.cpp in Sources */, DFF0F2BC17528350002DA3A4 /* LocalizeStrings.cpp in Sources */, DFF0F2BD17528350002DA3A4 /* MatrixGLES.cpp in Sources */, DFF0F2BE17528350002DA3A4 /* Shader.cpp in Sources */, @@ -12105,6 +12104,7 @@ DFF0F35E17528350002DA3A4 /* PlayList.cpp in Sources */, DFF0F35F17528350002DA3A4 /* PlayListB4S.cpp in Sources */, DFF0F36017528350002DA3A4 /* PlayListFactory.cpp in Sources */, + 395C29BE1A94733100EBC7AD /* Key.cpp in Sources */, DFF0F36117528350002DA3A4 /* PlayListM3U.cpp in Sources */, DF4BF0191A4EF31F0053AC56 /* cc_decoder.c in Sources */, DFF0F36217528350002DA3A4 /* PlayListPLS.cpp in Sources */, @@ -12666,6 +12666,7 @@ E49911CB174E5D2500741B6D /* DVDOverlayCodecTX3G.cpp in Sources */, E49911CE174E5D2500741B6D /* DVDVideoCodecFFmpeg.cpp in Sources */, E49911CF174E5D2500741B6D /* DVDVideoCodecLibMpeg2.cpp in Sources */, + 395C29BD1A94733100EBC7AD /* Key.cpp in Sources */, E49911D0174E5D2500741B6D /* DVDVideoCodecVDA.cpp in Sources */, E49911D1174E5D2500741B6D /* DVDVideoPPFFmpeg.cpp in Sources */, E49911D2174E5D2E00741B6D /* DVDDemux.cpp in Sources */, @@ -13015,7 +13016,6 @@ E4991321174E5DAD00741B6D /* imagefactory.cpp in Sources */, E4991322174E5DAD00741B6D /* IWindowManagerCallback.cpp in Sources */, E4991323174E5DAD00741B6D /* JpegIO.cpp in Sources */, - E4991324174E5DAD00741B6D /* Key.cpp in Sources */, E4991325174E5DAD00741B6D /* LocalizeStrings.cpp in Sources */, E4991326174E5DAD00741B6D /* MatrixGLES.cpp in Sources */, E4991327174E5DAD00741B6D /* Shader.cpp in Sources */, diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index ddf4344abe4a0..2b435131f07cd 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -484,7 +484,6 @@ - @@ -501,6 +500,7 @@ + @@ -900,6 +900,7 @@ + @@ -1842,7 +1843,6 @@ - @@ -2615,4 +2615,4 @@ - \ No newline at end of file + diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index 401c079e981a7..b335beb62eaeb 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -1120,9 +1120,6 @@ guilib - - guilib - guilib @@ -3146,6 +3143,9 @@ video\jobs + + + input network\httprequesthandler\python @@ -4087,9 +4087,6 @@ guilib - - guilib - guilib @@ -6145,6 +6142,9 @@ video\jobs + + + input network\httprequesthandler\python @@ -6218,4 +6218,4 @@ interfaces\swig - \ No newline at end of file + diff --git a/xbmc/AppParamParser.cpp b/xbmc/AppParamParser.cpp index 064671e9f4c52..08f4dad468b12 100644 --- a/xbmc/AppParamParser.cpp +++ b/xbmc/AppParamParser.cpp @@ -26,12 +26,10 @@ #include "settings/AdvancedSettings.h" #include "utils/log.h" #include "utils/StringUtils.h" +#include "input/InputManager.h" #ifdef TARGET_WINDOWS #include "WIN32Util.h" #endif -#ifdef HAS_LIRC -#include "input/linux/LIRC.h" -#endif #ifndef TARGET_WINDOWS #include "linux/XTimeUtils.h" #endif @@ -49,23 +47,22 @@ void CAppParamParser::Parse(const char* argv[], int nArgs) for (int i = 1; i < nArgs; i++) { ParseArg(argv[i]); -#ifdef HAS_LIRC if (strnicmp(argv[i], "-l", 2) == 0 || strnicmp(argv[i], "--lircdev", 9) == 0) { // check the next arg with the proper value. - int next=i+1; + int next = i + 1; if (next < nArgs) { - if ((argv[next][0] != '-' ) && (argv[next][0] == '/' )) + if ((argv[next][0] != '-') && (argv[next][0] == '/')) { - g_RemoteControl.setDeviceName(argv[next]); + CInputManager::Get().SetRemoteControlName(argv[next]); i++; } } } else if (strnicmp(argv[i], "-n", 2) == 0 || strnicmp(argv[i], "--nolirc", 8) == 0) - g_RemoteControl.setUsed(false); -#endif + CInputManager::Get().DisableRemoteControl(); + if (stricmp(argv[i], "-d") == 0) { if (i + 1 < nArgs) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index e262b7905bcf9..396a324343506 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -237,13 +237,6 @@ #include "XHandle.h" #endif -#ifdef HAS_LIRC -#include "input/linux/LIRC.h" -#endif -#ifdef HAS_IRSERVERSUITE - #include "input/windows/IRServerSuite.h" -#endif - #if defined(TARGET_ANDROID) #include "android/activity/XBMCApp.h" #include "android/activity/AndroidFeatures.h" @@ -378,18 +371,6 @@ bool CApplication::OnEvent(XBMC_Event& newEvent) if (!g_application.m_bStop) CApplicationMessenger::Get().Quit(); break; - case XBMC_KEYDOWN: - g_application.OnKey(g_Keyboard.ProcessKeyDown(newEvent.key.keysym)); - break; - case XBMC_KEYUP: - g_Keyboard.ProcessKeyUp(); - break; - case XBMC_MOUSEBUTTONDOWN: - case XBMC_MOUSEBUTTONUP: - case XBMC_MOUSEMOTION: - g_Mouse.HandleEvent(newEvent); - CInputManager::GetInstance().ProcessMouse(g_windowManager.GetActiveWindowID()); - break; case XBMC_VIDEORESIZE: if (!g_application.m_bInitializing && !g_advancedSettings.m_fullScreen) @@ -421,38 +402,6 @@ bool CApplication::OnEvent(XBMC_Event& newEvent) break; case XBMC_APPCOMMAND: return g_application.OnAppCommand(newEvent.appcommand.action); - case XBMC_TOUCH: - { - if (newEvent.touch.action == ACTION_TOUCH_TAP) - { // Send a mouse motion event with no dx,dy for getting the current guiitem selected - g_application.OnAction(CAction(ACTION_MOUSE_MOVE, 0, newEvent.touch.x, newEvent.touch.y, 0, 0)); - } - int actionId = 0; - if (newEvent.touch.action == ACTION_GESTURE_BEGIN || newEvent.touch.action == ACTION_GESTURE_END) - actionId = newEvent.touch.action; - else - { - int iWin = g_windowManager.GetActiveWindowID(); - CButtonTranslator::GetInstance().TranslateTouchAction(iWin, newEvent.touch.action, newEvent.touch.pointers, actionId); - } - - if (actionId <= 0) - return false; - - if ((actionId >= ACTION_TOUCH_TAP && actionId <= ACTION_GESTURE_END) - || (actionId >= ACTION_MOUSE_START && actionId <= ACTION_MOUSE_END) ) - CApplicationMessenger::Get().SendAction(CAction(actionId, 0, newEvent.touch.x, newEvent.touch.y, newEvent.touch.x2, newEvent.touch.y2), WINDOW_INVALID, false); - else - CApplicationMessenger::Get().SendAction(CAction(actionId), WINDOW_INVALID, false); - - // Post an unfocus message for touch device after the action. - if (newEvent.touch.action == ACTION_GESTURE_END || newEvent.touch.action == ACTION_TOUCH_TAP) - { - CGUIMessage msg(GUI_MSG_UNFOCUS_ALL, 0, 0, 0, 0); - CApplicationMessenger::Get().SendGUIMessage(msg); - } - break; - } case XBMC_SETFOCUS: // Reset the screensaver g_application.ResetScreenSaver(); @@ -460,6 +409,8 @@ bool CApplication::OnEvent(XBMC_Event& newEvent) // Send a mouse motion event with no dx,dy for getting the current guiitem selected g_application.OnAction(CAction(ACTION_MOUSE_MOVE, 0, static_cast(newEvent.focus.x), static_cast(newEvent.focus.y), 0, 0)); break; + default: + return CInputManager::Get().OnEvent(newEvent); } return true; } @@ -769,18 +720,12 @@ bool CApplication::Create() CLog::Log(LOGFATAL, "CApplication::Create: Unable to start CAddonMgr"); return false; } -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - g_RemoteControl.Initialize(); -#endif g_peripherals.Initialise(); // Create the Mouse, Keyboard, Remote, and Joystick devices // Initialize after loading settings to get joystick deadzone setting - 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. @@ -1318,7 +1263,7 @@ bool CApplication::Initialize() ResetScreenSaver(); #ifdef HAS_SDL_JOYSTICK - CInputManager::GetInstance().SetEnabledJoystick(CSettings::Get().GetBool("input.enablejoystick") && + CInputManager::Get().SetEnabledJoystick(CSettings::Get().GetBool("input.enablejoystick") && CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0 ); #endif @@ -2084,153 +2029,6 @@ void CApplication::SetStandAlone(bool value) g_advancedSettings.m_handleMounting = m_bStandalone = value; } -// OnKey() translates the key into a CAction which is sent on to our Window Manager. -// The window manager will return true if the event is processed, false otherwise. -// If not already processed, this routine handles global keypresses. It returns -// true if the key has been processed, false otherwise. - -bool CApplication::OnKey(const CKey& key) -{ - - // Turn the mouse off, as we've just got a keypress from controller or remote - g_Mouse.SetActive(false); - - // get the current active window - int iWin = g_windowManager.GetActiveWindowID(); - - // this will be checked for certain keycodes that need - // special handling if the screensaver is active - CAction action = CButtonTranslator::GetInstance().GetAction(iWin, key); - - // a key has been pressed. - // reset Idle Timer - m_idleTimer.StartZero(); - bool processKey = AlwaysProcess(action); - - if (StringUtils::StartsWithNoCase(action.GetName(),"CECToggleState") || StringUtils::StartsWithNoCase(action.GetName(),"CECStandby")) - { - // do not wake up the screensaver right after switching off the playing device - if (StringUtils::StartsWithNoCase(action.GetName(),"CECToggleState")) - { - CLog::LogF(LOGDEBUG, "action %s [%d], toggling state of playing device", action.GetName().c_str(), action.GetID()); - if (!CApplicationMessenger::Get().CECToggleState()) - return true; - } - else - { - CApplicationMessenger::Get().CECStandby(); - return true; - } - } - - ResetScreenSaver(); - - // allow some keys to be processed while the screensaver is active - if (WakeUpScreenSaverAndDPMS(processKey) && !processKey) - { - CLog::LogF(LOGDEBUG, "%s pressed, screen saver/dpms woken up", g_Keyboard.GetKeyName((int) key.GetButtonCode()).c_str()); - return true; - } - - if (iWin != WINDOW_FULLSCREEN_VIDEO) - { - // current active window isnt the fullscreen window - // just use corresponding section from keymap.xml - // to map key->action - - // first determine if we should use keyboard input directly - bool useKeyboard = key.FromKeyboard() && (iWin == WINDOW_DIALOG_KEYBOARD || iWin == WINDOW_DIALOG_NUMERIC); - CGUIWindow *window = g_windowManager.GetWindow(iWin); - if (window) - { - CGUIControl *control = window->GetFocusedControl(); - if (control) - { - // If this is an edit control set usekeyboard to true. This causes the - // keypress to be processed directly not through the key mappings. - if (control->GetControlType() == CGUIControl::GUICONTROL_EDIT) - useKeyboard = true; - - // If the key pressed is shift-A to shift-Z set usekeyboard to true. - // This causes the keypress to be used for list navigation. - if (control->IsContainer() && key.GetModifiers() == CKey::MODIFIER_SHIFT && key.GetVKey() >= XBMCVK_A && key.GetVKey() <= XBMCVK_Z) - useKeyboard = true; - } - } - if (useKeyboard) - { - // use the virtualkeyboard section of the keymap, and send keyboard-specific or navigation - // actions through if that's what they are - CAction action = CButtonTranslator::GetInstance().GetAction(WINDOW_DIALOG_KEYBOARD, key); - if (!(action.GetID() == ACTION_MOVE_LEFT || - action.GetID() == ACTION_MOVE_RIGHT || - action.GetID() == ACTION_MOVE_UP || - action.GetID() == ACTION_MOVE_DOWN || - action.GetID() == ACTION_SELECT_ITEM || - action.GetID() == ACTION_ENTER || - action.GetID() == ACTION_PREVIOUS_MENU || - action.GetID() == ACTION_NAV_BACK)) - { - // the action isn't plain navigation - check for a keyboard-specific keymap - action = CButtonTranslator::GetInstance().GetAction(WINDOW_DIALOG_KEYBOARD, key, false); - if (!(action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9) || - action.GetID() == ACTION_BACKSPACE || - action.GetID() == ACTION_SHIFT || - action.GetID() == ACTION_SYMBOLS || - action.GetID() == ACTION_CURSOR_LEFT || - action.GetID() == ACTION_CURSOR_RIGHT) - action = CAction(0); // don't bother with this action - } - // else pass the keys through directly - if (!action.GetID()) - { - if (key.GetFromService()) - action = CAction(key.GetButtonCode() != KEY_INVALID ? key.GetButtonCode() : 0, key.GetUnicode()); - else - { - // Check for paste keypress -#ifdef TARGET_WINDOWS - // In Windows paste is ctrl-V - if (key.GetVKey() == XBMCVK_V && key.GetModifiers() == CKey::MODIFIER_CTRL) -#elif defined(TARGET_LINUX) - // In Linux paste is ctrl-V - if (key.GetVKey() == XBMCVK_V && key.GetModifiers() == CKey::MODIFIER_CTRL) -#elif defined(TARGET_DARWIN_OSX) - // In OSX paste is cmd-V - if (key.GetVKey() == XBMCVK_V && key.GetModifiers() == CKey::MODIFIER_META) -#else - // Placeholder for other operating systems - if (false) -#endif - action = CAction(ACTION_PASTE); - // If the unicode is non-zero the keypress is a non-printing character - else if (key.GetUnicode()) - action = CAction(key.GetAscii() | KEY_ASCII, key.GetUnicode()); - // The keypress is a non-printing character - else - action = CAction(key.GetVKey() | KEY_VKEY); - } - } - - CLog::LogF(LOGDEBUG, "%s pressed, trying keyboard action %x", g_Keyboard.GetKeyName((int) key.GetButtonCode()).c_str(), action.GetID()); - - if (OnAction(action)) - return true; - // failed to handle the keyboard action, drop down through to standard action - } - if (key.GetFromService()) - { - if (key.GetButtonCode() != KEY_INVALID) - action = CButtonTranslator::GetInstance().GetAction(iWin, key); - } - else - 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()); - - return ExecuteInputAction(action); -} // OnAppCommand is called in response to a XBMC_APPCOMMAND event. // This needs to return true if it processed the appcommand or false if it didn't @@ -2286,7 +2084,7 @@ bool CApplication::OnAction(const CAction &action) } if (action.IsMouse()) - g_Mouse.SetActive(true); + CInputManager::Get().SetMouseActive(true); if (action.GetID() == ACTION_CREATE_EPISODE_BOOKMARK) @@ -2664,16 +2462,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) } CWinEvents::MessagePump(); -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - // Read the input from a remote - g_RemoteControl.Update(); -#endif + CInputManager::Get().Process(g_windowManager.GetActiveWindowID(), frameTime); - // process input actions - CInputManager::GetInstance().ProcessRemote(g_windowManager.GetActiveWindowID()); - CInputManager::GetInstance().ProcessGamepad(g_windowManager.GetActiveWindowID()); - CInputManager::GetInstance().ProcessEventServer(g_windowManager.GetActiveWindowID(), frameTime); - CInputManager::GetInstance().ProcessPeripherals(frameTime); if (processGUI && m_renderGUI) { m_pInertialScrollingHandler->ProcessInertialScroll(frameTime); @@ -2688,26 +2478,6 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) } } -bool CApplication::ExecuteInputAction(const CAction &action) -{ - bool bResult = false; - - // play sound before the action unless the button is held, - // where we execute after the action as held actions aren't fired every time. - if(action.GetHoldTime()) - { - bResult = OnAction(action); - if(bResult) - g_audioManager.PlayActionSound(action); - } - else - { - g_audioManager.PlayActionSound(action); - bResult = OnAction(action); - } - return bResult; -} - bool CApplication::Cleanup() @@ -2718,10 +2488,8 @@ bool CApplication::Cleanup() CAddonMgr::Get().DeInit(); -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) CLog::Log(LOGNOTICE, "closing down remote control service"); - g_RemoteControl.Disconnect(); -#endif + CInputManager::Get().DisableRemoteControl(); CLog::Log(LOGNOTICE, "unload sections"); @@ -4533,10 +4301,7 @@ void CApplication::ProcessSlow() g_mediaManager.ProcessEvents(); -#ifdef HAS_LIRC - if (g_RemoteControl.IsInUse() && !g_RemoteControl.IsInitialized()) - g_RemoteControl.Initialize(); -#endif + CInputManager::Get().EnableRemoteControl(); if (!m_pPlayer->IsPlayingVideo() && CSettings::Get().GetInt("general.addonupdates") != AUTO_UPDATES_NEVER) @@ -5105,33 +4870,6 @@ bool CApplication::ProcessAndStartPlaylist(const std::string& strPlayList, CPlay return false; } -bool CApplication::AlwaysProcess(const CAction& action) -{ - // check if this button is mapped to a built-in function - if (!action.GetName().empty()) - { - std::string builtInFunction; - vector params; - CUtil::SplitExecFunction(action.GetName(), builtInFunction, params); - StringUtils::ToLower(builtInFunction); - - // should this button be handled normally or just cancel the screensaver? - if ( builtInFunction == "powerdown" - || builtInFunction == "reboot" - || builtInFunction == "restart" - || builtInFunction == "restartapp" - || builtInFunction == "suspend" - || builtInFunction == "hibernate" - || builtInFunction == "quit" - || builtInFunction == "shutdown") - { - return true; - } - } - - return false; -} - bool CApplication::IsCurrentThread() const { return CThread::IsCurrentThread(m_threadID); diff --git a/xbmc/Application.h b/xbmc/Application.h index 1a9914c775846..683655596d780 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -75,7 +75,6 @@ class DPMSSupport; class CSplash; class CBookmark; class CNetwork; -class CInputManager; namespace VIDEO { @@ -117,7 +116,6 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs public ISettingCallback, public ISettingsHandler, public ISubSettings { friend class CApplicationPlayer; - friend class CInputManager; public: enum ESERVERS @@ -189,7 +187,6 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs bool IsPlayingFullScreenVideo() const; bool IsStartingPlayback() const { return m_bPlaybackStarting; } bool IsFullScreen(); - bool OnKey(const CKey& key); bool OnAppCommand(const CAction &action); bool OnAction(const CAction &action); void CheckShutdown(); @@ -484,11 +481,9 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs void VolumeChanged() const; PlayBackRet PlayStack(const CFileItem& item, bool bRestart); - bool ExecuteInputAction(const CAction &action); - + int GetActiveWindowID(void); float NavigationIdleTime(); - static bool AlwaysProcess(const CAction& action); bool InitDirectoriesLinux(); bool InitDirectoriesOSX(); diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp index 4d3e0139fc287..a46c9be9e76e8 100644 --- a/xbmc/ApplicationMessenger.cpp +++ b/xbmc/ApplicationMessenger.cpp @@ -37,7 +37,7 @@ #include "settings/Settings.h" #include "FileItem.h" #include "guilib/GUIDialog.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/GUIKeyboardFactory.h" #include "guilib/Resolution.h" #include "GUIInfoManager.h" diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp index 9a1ddb9fc4601..37a9459da2c66 100644 --- a/xbmc/PlayListPlayer.cpp +++ b/xbmc/PlayListPlayer.cpp @@ -35,7 +35,7 @@ #include "dialogs/GUIDialogKaiToast.h" #include "guilib/LocalizeStrings.h" #include "interfaces/AnnouncementManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "URL.h" using namespace PLAYLIST; diff --git a/xbmc/SystemGlobals.cpp b/xbmc/SystemGlobals.cpp index f51e075522b2b..12fb06696e27d 100644 --- a/xbmc/SystemGlobals.cpp +++ b/xbmc/SystemGlobals.cpp @@ -56,7 +56,6 @@ CGUITextureManager g_TextureManager; CGUILargeTextureManager g_largeTextureManager; - CMouseStat g_Mouse; CGUIPassword g_passwordManager; CGUIInfoManager g_infoManager; diff --git a/xbmc/addons/AddonCallbacksGUI.cpp b/xbmc/addons/AddonCallbacksGUI.cpp index 9028e1ac2547c..84878fe0c1a5c 100644 --- a/xbmc/addons/AddonCallbacksGUI.cpp +++ b/xbmc/addons/AddonCallbacksGUI.cpp @@ -30,7 +30,7 @@ #include "utils/TimeUtils.h" #include "utils/StringUtils.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/TextureManager.h" #include "guilib/GUISpinControlEx.h" #include "guilib/GUIRadioButtonControl.h" diff --git a/xbmc/addons/GUIDialogAddonInfo.cpp b/xbmc/addons/GUIDialogAddonInfo.cpp index 34cd30532dce3..fe3484f50b1a6 100644 --- a/xbmc/addons/GUIDialogAddonInfo.cpp +++ b/xbmc/addons/GUIDialogAddonInfo.cpp @@ -31,7 +31,7 @@ #include "dialogs/GUIDialogTextViewer.h" #include "GUIUserMessages.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "utils/JobManager.h" #include "utils/FileOperationJob.h" #include "utils/StringUtils.h" diff --git a/xbmc/addons/GUIDialogAddonSettings.cpp b/xbmc/addons/GUIDialogAddonSettings.cpp index 41edb263aedd9..ef1c3c2654d57 100644 --- a/xbmc/addons/GUIDialogAddonSettings.cpp +++ b/xbmc/addons/GUIDialogAddonSettings.cpp @@ -34,7 +34,7 @@ #include "guilib/GUIRadioButtonControl.h" #include "guilib/GUISpinControlEx.h" #include "guilib/GUIImage.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "filesystem/Directory.h" #include "video/VideoInfoScanner.h" #include "addons/Scraper.h" diff --git a/xbmc/addons/GUIWindowAddonBrowser.cpp b/xbmc/addons/GUIWindowAddonBrowser.cpp index 5c05d3c94bf0c..f4560dda4ae8d 100644 --- a/xbmc/addons/GUIWindowAddonBrowser.cpp +++ b/xbmc/addons/GUIWindowAddonBrowser.cpp @@ -47,7 +47,7 @@ #include "settings/AdvancedSettings.h" #include "storage/MediaManager.h" #include "LangInfo.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "ContextMenuManager.h" #define CONTROL_AUTOUPDATE 5 @@ -201,28 +201,28 @@ bool CGUIWindowAddonBrowser::OnContextButton(int itemNumber, AddonPtr addon; if (CAddonMgr::Get().GetAddon(pItem->GetProperty("Addon.ID").asString(), addon, ADDON_UNKNOWN, false)) { - if (button == CONTEXT_BUTTON_SETTINGS) - return CGUIDialogAddonSettings::ShowAndGetInput(addon); + if (button == CONTEXT_BUTTON_SETTINGS) + return CGUIDialogAddonSettings::ShowAndGetInput(addon); - if (button == CONTEXT_BUTTON_REFRESH) - { - CAddonDatabase database; - database.Open(); - database.DeleteRepository(addon->ID()); - button = CONTEXT_BUTTON_SCAN; - } + if (button == CONTEXT_BUTTON_REFRESH) + { + CAddonDatabase database; + database.Open(); + database.DeleteRepository(addon->ID()); + button = CONTEXT_BUTTON_SCAN; + } - if (button == CONTEXT_BUTTON_SCAN) - { - CAddonInstaller::Get().UpdateRepos(true); - return true; - } + if (button == CONTEXT_BUTTON_SCAN) + { + CAddonInstaller::Get().UpdateRepos(true); + return true; + } - if (button == CONTEXT_BUTTON_INFO) - { - CGUIDialogAddonInfo::ShowForItem(pItem); - return true; - } + if (button == CONTEXT_BUTTON_INFO) + { + CGUIDialogAddonInfo::ShowForItem(pItem); + return true; + } } return CGUIMediaWindow::OnContextButton(itemNumber, button); @@ -548,9 +548,9 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect // check if the addon is installed or can be installed if ((showInstallable || showMore) && !isInstalled && CAddonMgr::Get().CanAddonBeInstalled(pAddon)) - { + { ++addon; - continue; + continue; } } @@ -571,11 +571,11 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect std::map addonMap; CFileItemList items; for (ADDON::IVECADDONS addon = addons.begin(); addon != addons.end(); ++addon) - { + { CFileItemPtr item(CAddonsDirectory::FileItemFromAddon(*addon, "")); - if (!items.Contains(item->GetPath())) + if (!items.Contains(item->GetPath())) { - items.Add(item); + items.Add(item); addonMap.insert(std::make_pair(item->GetPath(), *addon)); } } @@ -638,7 +638,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect addonIDs.clear(); const CFileItemList& list = dialog->GetSelectedItems(); - for (int i = 0; i < list.Size(); i++) + for (int i = 0 ; i < list.Size() ; i++) { const CFileItemPtr& item = list.Get(i); diff --git a/xbmc/android/activity/AndroidKey.cpp b/xbmc/android/activity/AndroidKey.cpp index 34b9ceee72364..6f3cd961a4790 100644 --- a/xbmc/android/activity/AndroidKey.cpp +++ b/xbmc/android/activity/AndroidKey.cpp @@ -21,7 +21,7 @@ #include "AndroidKey.h" #include "AndroidExtra.h" #include "XBMCApp.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "windowing/WinEvents.h" #include "android/jni/KeyCharacterMap.h" diff --git a/xbmc/android/activity/XBMCApp.cpp b/xbmc/android/activity/XBMCApp.cpp index c69ac2603a33b..1cc1be5b57839 100644 --- a/xbmc/android/activity/XBMCApp.cpp +++ b/xbmc/android/activity/XBMCApp.cpp @@ -33,7 +33,7 @@ #include "input/MouseStat.h" #include "input/XBMC_keysym.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "windowing/XBMC_events.h" #include diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp index afc1206f0f78f..52e15be6d8d7e 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp @@ -39,15 +39,10 @@ #include "utils/TimeUtils.h" #include "utils/log.h" #include "cores/AudioEngine/AEFactory.h" +#include "input/InputManager.h" #if defined(TARGET_WINDOWS) #include "utils/CharsetConverter.h" #include "Windows.h" - #ifdef HAS_IRSERVERSUITE - #include "input/windows/IRServerSuite.h" - #endif -#endif -#if defined(HAS_LIRC) - #include "input/linux/LIRC.h" #endif #if defined(TARGET_ANDROID) #include "android/activity/XBMCApp.h" @@ -466,18 +461,14 @@ BOOL CExternalPlayer::ExecuteAppW32(const char* strPath, const char* strSwitches BOOL CExternalPlayer::ExecuteAppLinux(const char* strSwitches) { CLog::Log(LOGNOTICE, "%s: %s", __FUNCTION__, strSwitches); -#ifdef HAS_LIRC - bool remoteused = g_RemoteControl.IsInUse(); - g_RemoteControl.Disconnect(); - g_RemoteControl.setUsed(false); -#endif + + bool remoteUsed = CInputManager::Get().IsRemoteControlEnabled(); + CInputManager::Get().DisableRemoteControl(); int ret = system(strSwitches); -#ifdef HAS_LIRC - g_RemoteControl.setUsed(remoteused); - g_RemoteControl.Initialize(); -#endif + if (remoteUsed) + CInputManager::Get().EnableRemoteControl(); if (ret != 0) { diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index 5e16230fda725..3f221165e34ee 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -39,7 +39,7 @@ #include "DVDFileInfo.h" #include "utils/LangCodeExpander.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/URIUtils.h" diff --git a/xbmc/dialogs/GUIDialogContextMenu.cpp b/xbmc/dialogs/GUIDialogContextMenu.cpp index ae66af3676ad2..eaf8e1b037878 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.cpp +++ b/xbmc/dialogs/GUIDialogContextMenu.cpp @@ -35,7 +35,7 @@ #include "profiles/dialogs/GUIDialogLockSettings.h" #include "storage/MediaManager.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "GUIDialogYesNo.h" #include "addons/AddonManager.h" #include "FileItem.h" diff --git a/xbmc/dialogs/GUIDialogFavourites.cpp b/xbmc/dialogs/GUIDialogFavourites.cpp index de8372062fc9c..56952d1e6a389 100644 --- a/xbmc/dialogs/GUIDialogFavourites.cpp +++ b/xbmc/dialogs/GUIDialogFavourites.cpp @@ -25,7 +25,7 @@ #include "filesystem/FavouritesDirectory.h" #include "guilib/GUIWindowManager.h" #include "guilib/GUIKeyboardFactory.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "filesystem/File.h" #include "FileItem.h" #include "guilib/LocalizeStrings.h" diff --git a/xbmc/dialogs/GUIDialogFileBrowser.cpp b/xbmc/dialogs/GUIDialogFileBrowser.cpp index e1574271509a9..825e442afdc06 100644 --- a/xbmc/dialogs/GUIDialogFileBrowser.cpp +++ b/xbmc/dialogs/GUIDialogFileBrowser.cpp @@ -42,7 +42,7 @@ #include "settings/AdvancedSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/log.h" #include "URL.h" diff --git a/xbmc/dialogs/GUIDialogGamepad.cpp b/xbmc/dialogs/GUIDialogGamepad.cpp index fdd2c619fcc88..0a3dac660854c 100644 --- a/xbmc/dialogs/GUIDialogGamepad.cpp +++ b/xbmc/dialogs/GUIDialogGamepad.cpp @@ -25,7 +25,7 @@ #include "guilib/GUIWindowManager.h" #include "GUIDialogOK.h" #include "utils/StringUtils.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" CGUIDialogGamepad::CGUIDialogGamepad(void) diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp index 6ea4b0a2166f3..a29cd46024471 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp @@ -22,7 +22,7 @@ #include "input/XBMC_vkeys.h" #include "guilib/GUIEditControl.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "GUIUserMessages.h" #include "GUIDialogNumeric.h" diff --git a/xbmc/dialogs/GUIDialogMediaSource.cpp b/xbmc/dialogs/GUIDialogMediaSource.cpp index 533e6afabe31e..840f9159afb19 100644 --- a/xbmc/dialogs/GUIDialogMediaSource.cpp +++ b/xbmc/dialogs/GUIDialogMediaSource.cpp @@ -23,7 +23,7 @@ #include "GUIDialogFileBrowser.h" #include "video/windows/GUIWindowVideoBase.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "Util.h" #include "utils/URIUtils.h" #include "utils/StringUtils.h" diff --git a/xbmc/dialogs/GUIDialogNumeric.cpp b/xbmc/dialogs/GUIDialogNumeric.cpp index d69d7bc33db90..58d9c025f26f2 100644 --- a/xbmc/dialogs/GUIDialogNumeric.cpp +++ b/xbmc/dialogs/GUIDialogNumeric.cpp @@ -25,7 +25,7 @@ #include "GUIDialogOK.h" #include "input/XBMC_vkeys.h" #include "utils/StringUtils.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "interfaces/AnnouncementManager.h" diff --git a/xbmc/dialogs/GUIDialogSelect.cpp b/xbmc/dialogs/GUIDialogSelect.cpp index 736eb1a17c34a..acffb6c0738d4 100644 --- a/xbmc/dialogs/GUIDialogSelect.cpp +++ b/xbmc/dialogs/GUIDialogSelect.cpp @@ -21,7 +21,7 @@ #include "GUIDialogSelect.h" #include "guilib/GUIWindowManager.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/StringUtils.h" diff --git a/xbmc/dialogs/GUIDialogSlider.cpp b/xbmc/dialogs/GUIDialogSlider.cpp index 15d8cadfa77b9..a4a714744b552 100644 --- a/xbmc/dialogs/GUIDialogSlider.cpp +++ b/xbmc/dialogs/GUIDialogSlider.cpp @@ -21,7 +21,7 @@ #include "GUIDialogSlider.h" #include "guilib/GUISliderControl.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #define CONTROL_HEADING 10 diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp index dc5e86c6fbafd..430ec5390dc4c 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp +++ b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp @@ -29,7 +29,7 @@ #include "profiles/ProfilesManager.h" #include "settings/Settings.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" using namespace std; diff --git a/xbmc/dialogs/GUIDialogVolumeBar.cpp b/xbmc/dialogs/GUIDialogVolumeBar.cpp index b5684e534e28d..a4db6fa2cc0dc 100644 --- a/xbmc/dialogs/GUIDialogVolumeBar.cpp +++ b/xbmc/dialogs/GUIDialogVolumeBar.cpp @@ -19,7 +19,7 @@ */ #include "GUIDialogVolumeBar.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "utils/TimeUtils.h" #define VOLUME_BAR_DISPLAY_TIME 1000L diff --git a/xbmc/dialogs/GUIDialogYesNo.cpp b/xbmc/dialogs/GUIDialogYesNo.cpp index cb963c82111d0..4a4a097e22115 100644 --- a/xbmc/dialogs/GUIDialogYesNo.cpp +++ b/xbmc/dialogs/GUIDialogYesNo.cpp @@ -20,7 +20,7 @@ #include "GUIDialogYesNo.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #define CONTROL_NO_BUTTON 10 #define CONTROL_YES_BUTTON 11 diff --git a/xbmc/epg/GUIEPGGridContainer.cpp b/xbmc/epg/GUIEPGGridContainer.cpp index 987cb9cdd1a24..4f68961c3432c 100644 --- a/xbmc/epg/GUIEPGGridContainer.cpp +++ b/xbmc/epg/GUIEPGGridContainer.cpp @@ -18,7 +18,7 @@ * */ -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/GUIControlFactory.h" #include "guilib/GUIListItem.h" #include "guilib/LocalizeStrings.h" diff --git a/xbmc/guilib/GUIAudioManager.cpp b/xbmc/guilib/GUIAudioManager.cpp index 67b174486e0c9..3ca6e98d743af 100644 --- a/xbmc/guilib/GUIAudioManager.cpp +++ b/xbmc/guilib/GUIAudioManager.cpp @@ -20,7 +20,7 @@ #include "system.h" #include "GUIAudioManager.h" -#include "Key.h" +#include "input/Key.h" #include "input/ButtonTranslator.h" #include "settings/lib/Setting.h" #include "threads/SingleLock.h" diff --git a/xbmc/guilib/GUIBaseContainer.cpp b/xbmc/guilib/GUIBaseContainer.cpp index 651be06097f5a..0fc2c61393352 100644 --- a/xbmc/guilib/GUIBaseContainer.cpp +++ b/xbmc/guilib/GUIBaseContainer.cpp @@ -28,7 +28,7 @@ #include "utils/SortUtils.h" #include "utils/StringUtils.h" #include "FileItem.h" -#include "Key.h" +#include "input/Key.h" #include "utils/MathUtils.h" #include "utils/XBMCTinyXML.h" #include "listproviders/IListProvider.h" diff --git a/xbmc/guilib/GUIButtonControl.cpp b/xbmc/guilib/GUIButtonControl.cpp index ac0c1889e4782..fd9fe1da4666b 100644 --- a/xbmc/guilib/GUIButtonControl.cpp +++ b/xbmc/guilib/GUIButtonControl.cpp @@ -22,7 +22,7 @@ #include "GUIWindowManager.h" #include "GUIDialog.h" #include "GUIFontManager.h" -#include "Key.h" +#include "input/Key.h" using namespace std; diff --git a/xbmc/guilib/GUICheckMarkControl.cpp b/xbmc/guilib/GUICheckMarkControl.cpp index f0ca27cce20f5..3c55e94e1fc36 100644 --- a/xbmc/guilib/GUICheckMarkControl.cpp +++ b/xbmc/guilib/GUICheckMarkControl.cpp @@ -20,7 +20,7 @@ #include "GUICheckMarkControl.h" #include "GUIFontManager.h" -#include "Key.h" +#include "input/Key.h" using namespace std; diff --git a/xbmc/guilib/GUIControl.cpp b/xbmc/guilib/GUIControl.cpp index 164669bb120a2..c751416d48db3 100644 --- a/xbmc/guilib/GUIControl.cpp +++ b/xbmc/guilib/GUIControl.cpp @@ -26,7 +26,8 @@ #include "GUIWindowManager.h" #include "GUIControlProfiler.h" #include "input/MouseStat.h" -#include "Key.h" +#include "input/InputManager.h" +#include "input/Key.h" using namespace std; @@ -547,8 +548,8 @@ EVENT_RESULT CGUIControl::SendMouseEvent(const CPoint &point, const CMouseEvent // override this function to implement custom mouse behaviour bool CGUIControl::OnMouseOver(const CPoint &point) { - if (g_Mouse.GetState() != MOUSE_STATE_DRAG) - g_Mouse.SetState(MOUSE_STATE_FOCUS); + if (CInputManager::Get().GetMouseState() != MOUSE_STATE_DRAG) + CInputManager::Get().SetMouseState(MOUSE_STATE_FOCUS); if (!CanFocus()) return false; if (!HasFocus()) { diff --git a/xbmc/guilib/GUIControlFactory.cpp b/xbmc/guilib/GUIControlFactory.cpp index 497d22d82299b..84e9bea27b1ed 100644 --- a/xbmc/guilib/GUIControlFactory.cpp +++ b/xbmc/guilib/GUIControlFactory.cpp @@ -55,7 +55,7 @@ #include "GUIListLabel.h" #include "GUIListGroup.h" #include "GUIInfoManager.h" -#include "Key.h" +#include "input/Key.h" #include "addons/Skin.h" #include "utils/CharsetConverter.h" #include "utils/log.h" diff --git a/xbmc/guilib/GUIControlGroupList.cpp b/xbmc/guilib/GUIControlGroupList.cpp index 867f2bfedd872..5e9050bbe665b 100644 --- a/xbmc/guilib/GUIControlGroupList.cpp +++ b/xbmc/guilib/GUIControlGroupList.cpp @@ -19,7 +19,7 @@ */ #include "GUIControlGroupList.h" -#include "Key.h" +#include "input/Key.h" #include "GUIInfoManager.h" #include "GUIControlProfiler.h" #include "GUIFont.h" // for XBFONT_* definitions diff --git a/xbmc/guilib/GUIDialog.cpp b/xbmc/guilib/GUIDialog.cpp index 59b61d2f4eb2d..1a695e95310f6 100644 --- a/xbmc/guilib/GUIDialog.cpp +++ b/xbmc/guilib/GUIDialog.cpp @@ -26,7 +26,7 @@ #include "utils/TimeUtils.h" #include "Application.h" #include "ApplicationMessenger.h" -#include "Key.h" +#include "input/Key.h" CGUIDialog::CGUIDialog(int id, const std::string &xmlFile) : CGUIWindow(id, xmlFile) diff --git a/xbmc/guilib/GUIEditControl.cpp b/xbmc/guilib/GUIEditControl.cpp index eb1fcdbafd43b..e9b4877d57b48 100644 --- a/xbmc/guilib/GUIEditControl.cpp +++ b/xbmc/guilib/GUIEditControl.cpp @@ -24,7 +24,7 @@ #include "GUIKeyboardFactory.h" #include "dialogs/GUIDialogNumeric.h" #include "input/XBMC_vkeys.h" -#include "Key.h" +#include "input/Key.h" #include "LocalizeStrings.h" #include "XBDateTime.h" #include "windowing/WindowingFactory.h" diff --git a/xbmc/guilib/GUIFixedListContainer.cpp b/xbmc/guilib/GUIFixedListContainer.cpp index 658dc31bdcd28..560081fc5e8ac 100644 --- a/xbmc/guilib/GUIFixedListContainer.cpp +++ b/xbmc/guilib/GUIFixedListContainer.cpp @@ -20,7 +20,7 @@ #include "GUIFixedListContainer.h" #include "GUIListItem.h" -#include "Key.h" +#include "input/Key.h" CGUIFixedListContainer::CGUIFixedListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, int fixedPosition, int cursorRange) : CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems) diff --git a/xbmc/guilib/GUIListContainer.cpp b/xbmc/guilib/GUIListContainer.cpp index c3516ddcbf506..06be586f02ab6 100644 --- a/xbmc/guilib/GUIListContainer.cpp +++ b/xbmc/guilib/GUIListContainer.cpp @@ -21,7 +21,7 @@ #include "system.h" #include "GUIListContainer.h" #include "GUIListItem.h" -#include "Key.h" +#include "input/Key.h" #include "utils/StringUtils.h" CGUIListContainer::CGUIListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems) diff --git a/xbmc/guilib/GUIMoverControl.cpp b/xbmc/guilib/GUIMoverControl.cpp index 484e70b2a12ae..0ac8a94eb36b4 100644 --- a/xbmc/guilib/GUIMoverControl.cpp +++ b/xbmc/guilib/GUIMoverControl.cpp @@ -20,7 +20,7 @@ #include "GUIMoverControl.h" #include "GUIWindowManager.h" -#include "Key.h" +#include "input/Key.h" #include "utils/TimeUtils.h" // time to reset accelerated cursors (digital movement) diff --git a/xbmc/guilib/GUIMultiImage.cpp b/xbmc/guilib/GUIMultiImage.cpp index 614527fc56369..bdd39a722bbb7 100644 --- a/xbmc/guilib/GUIMultiImage.cpp +++ b/xbmc/guilib/GUIMultiImage.cpp @@ -25,7 +25,7 @@ #include "utils/JobManager.h" #include "FileItem.h" #include "settings/AdvancedSettings.h" -#include "Key.h" +#include "input/Key.h" #include "TextureCache.h" #include "WindowIDs.h" #include "utils/StringUtils.h" diff --git a/xbmc/guilib/GUIMultiSelectText.cpp b/xbmc/guilib/GUIMultiSelectText.cpp index 8be30afdeff17..edf8ce8bec273 100644 --- a/xbmc/guilib/GUIMultiSelectText.cpp +++ b/xbmc/guilib/GUIMultiSelectText.cpp @@ -20,7 +20,7 @@ #include "GUIMultiSelectText.h" #include "GUIWindowManager.h" -#include "Key.h" +#include "input/Key.h" #include "utils/log.h" #include "utils/StringUtils.h" diff --git a/xbmc/guilib/GUIPanelContainer.cpp b/xbmc/guilib/GUIPanelContainer.cpp index 042c8d492b7f1..628c50ca82626 100644 --- a/xbmc/guilib/GUIPanelContainer.cpp +++ b/xbmc/guilib/GUIPanelContainer.cpp @@ -21,7 +21,7 @@ #include "GUIPanelContainer.h" #include "GUIListItem.h" #include "GUIInfoManager.h" -#include "Key.h" +#include "input/Key.h" #include diff --git a/xbmc/guilib/GUIRadioButtonControl.cpp b/xbmc/guilib/GUIRadioButtonControl.cpp index 3323dc0107d8d..3b2ddfbcd528b 100644 --- a/xbmc/guilib/GUIRadioButtonControl.cpp +++ b/xbmc/guilib/GUIRadioButtonControl.cpp @@ -21,7 +21,7 @@ #include "GUIRadioButtonControl.h" #include "GUIInfoManager.h" #include "GUIFontManager.h" -#include "Key.h" +#include "input/Key.h" CGUIRadioButtonControl::CGUIRadioButtonControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, diff --git a/xbmc/guilib/GUIResizeControl.cpp b/xbmc/guilib/GUIResizeControl.cpp index 01e4b9663670d..9b3457f628496 100644 --- a/xbmc/guilib/GUIResizeControl.cpp +++ b/xbmc/guilib/GUIResizeControl.cpp @@ -20,7 +20,7 @@ #include "GUIResizeControl.h" #include "GUIWindowManager.h" -#include "Key.h" +#include "input/Key.h" #include "utils/TimeUtils.h" // time to reset accelerated cursors (digital movement) diff --git a/xbmc/guilib/GUIScrollBarControl.cpp b/xbmc/guilib/GUIScrollBarControl.cpp index dfd35c4c950d3..d426ba1487482 100644 --- a/xbmc/guilib/GUIScrollBarControl.cpp +++ b/xbmc/guilib/GUIScrollBarControl.cpp @@ -19,7 +19,7 @@ */ #include "GUIScrollBarControl.h" -#include "Key.h" +#include "input/Key.h" #include "utils/StringUtils.h" #define MIN_NIB_SIZE 4.0f diff --git a/xbmc/guilib/GUISelectButtonControl.cpp b/xbmc/guilib/GUISelectButtonControl.cpp index 1143dd6c0eeed..41802a5533180 100644 --- a/xbmc/guilib/GUISelectButtonControl.cpp +++ b/xbmc/guilib/GUISelectButtonControl.cpp @@ -21,7 +21,7 @@ #include "GUISelectButtonControl.h" #include "GUIWindowManager.h" #include "utils/TimeUtils.h" -#include "Key.h" +#include "input/Key.h" CGUISelectButtonControl::CGUISelectButtonControl(int parentID, int controlID, float posX, float posY, diff --git a/xbmc/guilib/GUISliderControl.cpp b/xbmc/guilib/GUISliderControl.cpp index d97df5650de0d..a076f131b040d 100644 --- a/xbmc/guilib/GUISliderControl.cpp +++ b/xbmc/guilib/GUISliderControl.cpp @@ -20,7 +20,7 @@ #include "GUISliderControl.h" #include "GUIInfoManager.h" -#include "Key.h" +#include "input/Key.h" #include "utils/MathUtils.h" #include "utils/StringUtils.h" #include "GUIWindowManager.h" diff --git a/xbmc/guilib/GUISpinControl.cpp b/xbmc/guilib/GUISpinControl.cpp index 91739ea8a37e5..57a9f6f135d4a 100644 --- a/xbmc/guilib/GUISpinControl.cpp +++ b/xbmc/guilib/GUISpinControl.cpp @@ -19,7 +19,7 @@ */ #include "GUISpinControl.h" -#include "Key.h" +#include "input/Key.h" #include "utils/StringUtils.h" #include diff --git a/xbmc/guilib/GUIToggleButtonControl.cpp b/xbmc/guilib/GUIToggleButtonControl.cpp index bf0fe93cb76ba..a401700fa9849 100644 --- a/xbmc/guilib/GUIToggleButtonControl.cpp +++ b/xbmc/guilib/GUIToggleButtonControl.cpp @@ -22,7 +22,7 @@ #include "GUIWindowManager.h" #include "GUIDialog.h" #include "GUIInfoManager.h" -#include "Key.h" +#include "input/Key.h" using namespace std; diff --git a/xbmc/guilib/GUIVideoControl.cpp b/xbmc/guilib/GUIVideoControl.cpp index 2b8c2cf92e670..b5be83627bc38 100644 --- a/xbmc/guilib/GUIVideoControl.cpp +++ b/xbmc/guilib/GUIVideoControl.cpp @@ -22,7 +22,7 @@ #include "GUIVideoControl.h" #include "GUIWindowManager.h" #include "Application.h" -#include "Key.h" +#include "input/Key.h" #include "WindowIDs.h" #include "cores/IPlayer.h" #ifdef HAS_VIDEO_PLAYBACK diff --git a/xbmc/guilib/GUIVisualisationControl.cpp b/xbmc/guilib/GUIVisualisationControl.cpp index bcac34456affc..36cf5f961f4d0 100644 --- a/xbmc/guilib/GUIVisualisationControl.cpp +++ b/xbmc/guilib/GUIVisualisationControl.cpp @@ -26,7 +26,7 @@ #include "addons/Visualisation.h" #include "utils/log.h" #include "guilib/IRenderingCallback.h" -#include "Key.h" +#include "input/Key.h" using namespace std; using namespace ADDON; diff --git a/xbmc/guilib/GUIWindow.cpp b/xbmc/guilib/GUIWindow.cpp index 6c0117ea22950..ae5e1abc0f37f 100644 --- a/xbmc/guilib/GUIWindow.cpp +++ b/xbmc/guilib/GUIWindow.cpp @@ -21,7 +21,7 @@ #include "system.h" #include "GUIWindow.h" #include "GUIWindowManager.h" -#include "Key.h" +#include "input/Key.h" #include "LocalizeStrings.h" #include "GUIControlFactory.h" #include "GUIControlGroup.h" diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp index 4829d88e572a6..99a8934330524 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -33,7 +33,7 @@ #include "GUITexture.h" #include "windowing/WindowingFactory.h" #include "utils/Variant.h" -#include "Key.h" +#include "input/Key.h" #include "utils/StringUtils.h" #include "windows/GUIWindowHome.h" diff --git a/xbmc/guilib/GUIWrappingListContainer.cpp b/xbmc/guilib/GUIWrappingListContainer.cpp index 50ec9a245640c..8afa59e752376 100644 --- a/xbmc/guilib/GUIWrappingListContainer.cpp +++ b/xbmc/guilib/GUIWrappingListContainer.cpp @@ -20,7 +20,7 @@ #include "GUIWrappingListContainer.h" #include "FileItem.h" -#include "Key.h" +#include "input/Key.h" #include "utils/log.h" CGUIWrappingListContainer::CGUIWrappingListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, int fixedPosition) diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp index ca38fdcc4e1e1..58406f7c9d270 100644 --- a/xbmc/guilib/GraphicContext.cpp +++ b/xbmc/guilib/GraphicContext.cpp @@ -30,7 +30,7 @@ #include "cores/VideoRenderers/RenderManager.h" #include "windowing/WindowingFactory.h" #include "TextureManager.h" -#include "input/MouseStat.h" +#include "input/InputManager.h" #include "GUIWindowManager.h" #include "utils/JobManager.h" #include "video/VideoReferenceClock.h" @@ -489,7 +489,7 @@ void CGraphicContext::SetVideoResolutionInternal(RESOLUTION res, bool forceUpdat // update anyone that relies on sizing information g_renderManager.Recover(); - g_Mouse.SetResolution(info_org.iWidth, info_org.iHeight, 1, 1); + CInputManager::Get().SetMouseResolution(info_org.iWidth, info_org.iHeight, 1, 1); g_windowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_WINDOW_RESIZE); Unlock(); diff --git a/xbmc/guilib/Makefile.in b/xbmc/guilib/Makefile.in index 2b911b34108a2..89a766d38f33c 100644 --- a/xbmc/guilib/Makefile.in +++ b/xbmc/guilib/Makefile.in @@ -66,7 +66,6 @@ SRCS += GUIWrappingListContainer.cpp SRCS += imagefactory.cpp SRCS += IWindowManagerCallback.cpp SRCS += JpegIO.cpp -SRCS += Key.cpp SRCS += LocalizeStrings.cpp SRCS += Shader.cpp SRCS += StereoscopicsManager.cpp diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp index 9ee19479551f6..aafde66bf03c9 100644 --- a/xbmc/guilib/StereoscopicsManager.cpp +++ b/xbmc/guilib/StereoscopicsManager.cpp @@ -34,7 +34,7 @@ #include "GUIInfoManager.h" #include "GUIUserMessages.h" #include "guilib/LocalizeStrings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/GUIWindowManager.h" #include "settings/AdvancedSettings.h" #include "settings/lib/ISettingCallback.h" diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index c748ff86e001c..44f2374cfafec 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -23,7 +23,7 @@ #include "ButtonTranslator.h" #include "profiles/ProfilesManager.h" #include "utils/URIUtils.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/WindowIDs.h" #include "input/XBMC_keysym.h" #include "input/XBMC_keytable.h" diff --git a/xbmc/input/InertialScrollingHandler.cpp b/xbmc/input/InertialScrollingHandler.cpp index 2ee2dd82ee273..d1dcd592350fd 100644 --- a/xbmc/input/InertialScrollingHandler.cpp +++ b/xbmc/input/InertialScrollingHandler.cpp @@ -23,7 +23,7 @@ #include "InertialScrollingHandler.h" #include "Application.h" #include "utils/TimeUtils.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/GUIWindowManager.h" #include "windowing/WindowingFactory.h" diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp index 0c5519a983b56..37266d3421f45 100644 --- a/xbmc/input/InputManager.cpp +++ b/xbmc/input/InputManager.cpp @@ -18,13 +18,18 @@ * */ -#include -#include #include #include "Application.h" #include "InputManager.h" +#include "input/Key.h" +#include "ApplicationMessenger.h" #include "guilib/Geometry.h" +#include "guilib/GUIAudioManager.h" +#include "guilib/GUIControl.h" +#include "guilib/GUIWindow.h" +#include "guilib/GUIWindowManager.h" +#include "guilib/GUIMessage.h" #ifdef HAS_EVENT_SERVER #include "network/EventServer.h" @@ -50,10 +55,13 @@ #include "input/SDLJoystick.h" #endif #include "ButtonTranslator.h" -#include "guilib/Key.h" -#include "input/MouseStat.h" #include "peripherals/Peripherals.h" +#include "peripherals/devices/PeripheralImon.h" +#include "XBMC_vkeys.h" #include "utils/log.h" +#include "utils/StringUtils.h" +#include "Util.h" +#include "settings/Settings.h" #ifdef HAS_PERFORMANCE_SAMPLE #include "utils/PerformanceSample.h" @@ -62,17 +70,34 @@ #endif #ifdef HAS_EVENT_SERVER -using namespace EVENTSERVER; +using EVENTSERVER::CEventServer; #endif -using namespace PERIPHERALS; +using PERIPHERALS::CPeripherals; -CInputManager& CInputManager::GetInstance() +CInputManager& CInputManager::Get() { static CInputManager inputManager; return inputManager; } +void CInputManager::InitializeInputs() +{ +#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) + m_RemoteControl.Initialize(); +#endif + +#ifdef HAS_SDL_JOYSTICK + // Pass the mapping of axis to triggers to m_Joystick + m_Joystick.Initialize(); +#endif + + m_Keyboard.Initialize(); + + m_Mouse.Initialize(); + m_Mouse.SetEnabled(CSettings::Get().GetBool("input.enablemouse")); +} + void CInputManager::ReInitializeJoystick() { #ifdef HAS_SDL_JOYSTICK @@ -122,8 +147,8 @@ bool CInputManager::ProcessGamepad(int windowId) if (CButtonTranslator::GetInstance().TranslateJoystickString(windowId, joyName, keymapId, JACTIVE_BUTTON, actionID, actionName, fullrange)) { CAction action(actionID, 1.0f, 0.0f, actionName); - g_Mouse.SetActive(false); - return g_application.ExecuteInputAction(action); + m_Mouse.SetActive(false); + return ExecuteInputAction(action); } } if (m_Joystick.GetAxis(joyName, joyId)) @@ -147,8 +172,8 @@ bool CInputManager::ProcessGamepad(int windowId) float amount = m_Joystick.GetAmount(joyName, joyId); CAction action(actionID, fullrange ? (amount + 1.0f) / 2.0f : fabs(amount), 0.0f, actionName); - g_Mouse.SetActive(false); - return g_application.ExecuteInputAction(action); + m_Mouse.SetActive(false); + return ExecuteInputAction(action); } } int position = 0; @@ -174,8 +199,8 @@ bool CInputManager::ProcessGamepad(int windowId) if (keymapId && CButtonTranslator::GetInstance().TranslateJoystickString(windowId, joyName, keymapId, JACTIVE_HAT, actionID, actionName, fullrange)) { CAction action(actionID, 1.0f, 0.0f, actionName); - g_Mouse.SetActive(false); - return g_application.ExecuteInputAction(action); + m_Mouse.SetActive(false); + return ExecuteInputAction(action); } } #endif @@ -185,11 +210,11 @@ bool CInputManager::ProcessGamepad(int windowId) bool CInputManager::ProcessRemote(int windowId) { #if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - if (g_RemoteControl.GetButton()) + if (m_RemoteControl.GetButton()) { - CKey key(g_RemoteControl.GetButton(), g_RemoteControl.GetHoldTime()); - g_RemoteControl.Reset(); - return g_application.OnKey(key); + CKey key(m_RemoteControl.GetButton(), m_RemoteControl.GetHoldTime()); + m_RemoteControl.Reset(); + return OnKey(key); } #endif return false; @@ -199,7 +224,7 @@ bool CInputManager::ProcessPeripherals(float frameTime) { CKey key; if (g_peripherals.GetNextKeypress(frameTime, key)) - return g_application.OnKey(key); + return OnKey(key); return false; } @@ -207,11 +232,11 @@ bool CInputManager::ProcessMouse(int windowId) { MEASURE_FUNCTION; - if (!g_Mouse.IsActive() || !g_application.IsAppFocused()) + if (!m_Mouse.IsActive() || !g_application.IsAppFocused()) return false; // Get the mouse command ID - uint32_t mousekey = g_Mouse.GetKey(); + uint32_t mousekey = m_Mouse.GetKey(); if (mousekey == KEY_MOUSE_NOOP) return true; @@ -228,7 +253,7 @@ bool CInputManager::ProcessMouse(int windowId) // Deactivate mouse if non-mouse action if (!mouseaction.IsMouse()) - g_Mouse.SetActive(false); + m_Mouse.SetActive(false); // Consume ACTION_NOOP. // Some views or dialogs gets closed after any ACTION and @@ -256,11 +281,11 @@ bool CInputManager::ProcessMouse(int windowId) // This is a mouse action so we need to record the mouse position return g_application.OnAction(CAction(mouseaction.GetID(), - g_Mouse.GetHold(MOUSE_LEFT_BUTTON), - (float)g_Mouse.GetX(), - (float)g_Mouse.GetY(), - (float)g_Mouse.GetDX(), - (float)g_Mouse.GetDY(), + m_Mouse.GetHold(MOUSE_LEFT_BUTTON), + (float)m_Mouse.GetX(), + (float)m_Mouse.GetY(), + (float)m_Mouse.GetDX(), + (float)m_Mouse.GetDY(), mouseaction.GetName())); } @@ -312,7 +337,7 @@ bool CInputManager::ProcessEventServer(int windowId, float frameTime) if (wKeyID & ES_FLAG_UNICODE) { key = CKey((uint8_t)0, wKeyID & ~ES_FLAG_UNICODE, 0, 0, 0); - return g_application.OnKey(key); + return OnKey(key); } if (wKeyID == KEY_BUTTON_LEFT_ANALOG_TRIGGER) @@ -338,7 +363,7 @@ bool CInputManager::ProcessEventServer(int windowId, float frameTime) else key = CKey(wKeyID); key.SetFromService(true); - return g_application.OnKey(key); + return OnKey(key); } } @@ -354,7 +379,7 @@ bool CInputManager::ProcessEventServer(int windowId, float frameTime) { CPoint pos; - if (es->GetMousePos(pos.x, pos.y) && g_Mouse.IsEnabled()) + if (es->GetMousePos(pos.x, pos.y) && m_Mouse.IsEnabled()) { XBMC_Event newEvent; newEvent.type = XBMC_MOUSEMOTION; @@ -372,6 +397,22 @@ bool CInputManager::ProcessEventServer(int windowId, float frameTime) return false; } +bool CInputManager::Process(int windowId, float frameTime) +{ +#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) + // Read the input from a remote + m_RemoteControl.Update(); +#endif + + // process input actions + ProcessRemote(windowId); + ProcessGamepad(windowId); + ProcessEventServer(windowId, frameTime); + ProcessPeripherals(frameTime); + + return true; +} + bool CInputManager::ProcessJoystickEvent(int windowId, const std::string& joystickName, int wKeyID, short inputType, float fAmount, unsigned int holdTime /*=0*/) { #if defined(HAS_EVENT_SERVER) @@ -381,7 +422,7 @@ bool CInputManager::ProcessJoystickEvent(int windowId, const std::string& joysti if (g_application.WakeUpScreenSaverAndDPMS()) return true; - g_Mouse.SetActive(false); + m_Mouse.SetActive(false); int actionID; std::string actionName; @@ -389,10 +430,372 @@ bool CInputManager::ProcessJoystickEvent(int windowId, const std::string& joysti // Translate using regular joystick translator. if (CButtonTranslator::GetInstance().TranslateJoystickString(windowId, joystickName, wKeyID, inputType, actionID, actionName, fullRange)) - return g_application.ExecuteInputAction(CAction(actionID, fAmount, 0.0f, actionName, holdTime)); + return ExecuteInputAction(CAction(actionID, fAmount, 0.0f, actionName, holdTime)); else CLog::Log(LOGDEBUG, "ERROR mapping joystick action. Joystick: %s %i", joystickName.c_str(), wKeyID); #endif return false; } + +bool CInputManager::OnEvent(XBMC_Event& newEvent) +{ + switch (newEvent.type) + { + case XBMC_KEYDOWN: + OnKey(m_Keyboard.ProcessKeyDown(newEvent.key.keysym)); + break; + case XBMC_KEYUP: + m_Keyboard.ProcessKeyUp(); + break; + case XBMC_MOUSEBUTTONDOWN: + case XBMC_MOUSEBUTTONUP: + case XBMC_MOUSEMOTION: + m_Mouse.HandleEvent(newEvent); + ProcessMouse(g_windowManager.GetActiveWindowID()); + break; + case XBMC_TOUCH: + { + if (newEvent.touch.action == ACTION_TOUCH_TAP) + { // Send a mouse motion event with no dx,dy for getting the current guiitem selected + g_application.OnAction(CAction(ACTION_MOUSE_MOVE, 0, newEvent.touch.x, newEvent.touch.y, 0, 0)); + } + int actionId = 0; + if (newEvent.touch.action == ACTION_GESTURE_BEGIN || newEvent.touch.action == ACTION_GESTURE_END) + actionId = newEvent.touch.action; + else + { + int iWin = g_windowManager.GetActiveWindowID(); + CButtonTranslator::GetInstance().TranslateTouchAction(iWin, newEvent.touch.action, newEvent.touch.pointers, actionId); + } + + if (actionId <= 0) + return false; + + if ((actionId >= ACTION_TOUCH_TAP && actionId <= ACTION_GESTURE_END) + || (actionId >= ACTION_MOUSE_START && actionId <= ACTION_MOUSE_END)) + CApplicationMessenger::Get().SendAction(CAction(actionId, 0, newEvent.touch.x, newEvent.touch.y, newEvent.touch.x2, newEvent.touch.y2), WINDOW_INVALID, false); + else + CApplicationMessenger::Get().SendAction(CAction(actionId), WINDOW_INVALID, false); + + // Post an unfocus message for touch device after the action. + if (newEvent.touch.action == ACTION_GESTURE_END || newEvent.touch.action == ACTION_TOUCH_TAP) + { + CGUIMessage msg(GUI_MSG_UNFOCUS_ALL, 0, 0, 0, 0); + CApplicationMessenger::Get().SendGUIMessage(msg); + } + break; + } //case + }//switch + + return true; +} + +// OnKey() translates the key into a CAction which is sent on to our Window Manager. +// The window manager will return true if the event is processed, false otherwise. +// If not already processed, this routine handles global keypresses. It returns +// true if the key has been processed, false otherwise. + +bool CInputManager::OnKey(const CKey& key) +{ + + // Turn the mouse off, as we've just got a keypress from controller or remote + m_Mouse.SetActive(false); + + // get the current active window + int iWin = g_windowManager.GetActiveWindowID(); + + // this will be checked for certain keycodes that need + // special handling if the screensaver is active + CAction action = CButtonTranslator::GetInstance().GetAction(iWin, key); + + // a key has been pressed. + // reset Idle Timer + g_application.ResetSystemIdleTimer(); + bool processKey = AlwaysProcess(action); + + if (StringUtils::StartsWithNoCase(action.GetName(), "CECToggleState") || StringUtils::StartsWithNoCase(action.GetName(), "CECStandby")) + { + // do not wake up the screensaver right after switching off the playing device + if (StringUtils::StartsWithNoCase(action.GetName(), "CECToggleState")) + { + CLog::LogF(LOGDEBUG, "action %s [%d], toggling state of playing device", action.GetName().c_str(), action.GetID()); + if (!CApplicationMessenger::Get().CECToggleState()) + return true; + } + else + { + CApplicationMessenger::Get().CECStandby(); + return true; + } + } + + g_application.ResetScreenSaver(); + + // 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", m_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str()); + return true; + } + + if (iWin != WINDOW_FULLSCREEN_VIDEO) + { + // current active window isnt the fullscreen window + // just use corresponding section from keymap.xml + // to map key->action + + // first determine if we should use keyboard input directly + bool useKeyboard = key.FromKeyboard() && (iWin == WINDOW_DIALOG_KEYBOARD || iWin == WINDOW_DIALOG_NUMERIC); + CGUIWindow *window = g_windowManager.GetWindow(iWin); + if (window) + { + CGUIControl *control = window->GetFocusedControl(); + if (control) + { + // If this is an edit control set usekeyboard to true. This causes the + // keypress to be processed directly not through the key mappings. + if (control->GetControlType() == CGUIControl::GUICONTROL_EDIT) + useKeyboard = true; + + // If the key pressed is shift-A to shift-Z set usekeyboard to true. + // This causes the keypress to be used for list navigation. + if (control->IsContainer() && key.GetModifiers() == CKey::MODIFIER_SHIFT && key.GetVKey() >= XBMCVK_A && key.GetVKey() <= XBMCVK_Z) + useKeyboard = true; + } + } + if (useKeyboard) + { + // use the virtualkeyboard section of the keymap, and send keyboard-specific or navigation + // actions through if that's what they are + CAction action = CButtonTranslator::GetInstance().GetAction(WINDOW_DIALOG_KEYBOARD, key); + if (!(action.GetID() == ACTION_MOVE_LEFT || + action.GetID() == ACTION_MOVE_RIGHT || + action.GetID() == ACTION_MOVE_UP || + action.GetID() == ACTION_MOVE_DOWN || + action.GetID() == ACTION_SELECT_ITEM || + action.GetID() == ACTION_ENTER || + action.GetID() == ACTION_PREVIOUS_MENU || + action.GetID() == ACTION_NAV_BACK)) + { + // the action isn't plain navigation - check for a keyboard-specific keymap + action = CButtonTranslator::GetInstance().GetAction(WINDOW_DIALOG_KEYBOARD, key, false); + if (!(action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9) || + action.GetID() == ACTION_BACKSPACE || + action.GetID() == ACTION_SHIFT || + action.GetID() == ACTION_SYMBOLS || + action.GetID() == ACTION_CURSOR_LEFT || + action.GetID() == ACTION_CURSOR_RIGHT) + action = CAction(0); // don't bother with this action + } + // else pass the keys through directly + if (!action.GetID()) + { + if (key.GetFromService()) + action = CAction(key.GetButtonCode() != KEY_INVALID ? key.GetButtonCode() : 0, key.GetUnicode()); + else + { + // Check for paste keypress +#ifdef TARGET_WINDOWS + // In Windows paste is ctrl-V + if (key.GetVKey() == XBMCVK_V && key.GetModifiers() == CKey::MODIFIER_CTRL) +#elif defined(TARGET_LINUX) + // In Linux paste is ctrl-V + if (key.GetVKey() == XBMCVK_V && key.GetModifiers() == CKey::MODIFIER_CTRL) +#elif defined(TARGET_DARWIN_OSX) + // In OSX paste is cmd-V + if (key.GetVKey() == XBMCVK_V && key.GetModifiers() == CKey::MODIFIER_META) +#else + // Placeholder for other operating systems + if (false) +#endif + action = CAction(ACTION_PASTE); + // If the unicode is non-zero the keypress is a non-printing character + else if (key.GetUnicode()) + action = CAction(key.GetAscii() | KEY_ASCII, key.GetUnicode()); + // The keypress is a non-printing character + else + action = CAction(key.GetVKey() | KEY_VKEY); + } + } + + 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; + // failed to handle the keyboard action, drop down through to standard action + } + if (key.GetFromService()) + { + if (key.GetButtonCode() != KEY_INVALID) + action = CButtonTranslator::GetInstance().GetAction(iWin, key); + } + else + action = CButtonTranslator::GetInstance().GetAction(iWin, key); + } + if (!key.IsAnalogButton()) + CLog::LogF(LOGDEBUG, "%s pressed, action is %s", m_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str(), action.GetName().c_str()); + + return ExecuteInputAction(action); +} + +bool CInputManager::AlwaysProcess(const CAction& action) +{ + // check if this button is mapped to a built-in function + if (!action.GetName().empty()) + { + std::string builtInFunction; + std::vector params; + CUtil::SplitExecFunction(action.GetName(), builtInFunction, params); + StringUtils::ToLower(builtInFunction); + + // should this button be handled normally or just cancel the screensaver? + if (builtInFunction == "powerdown" + || builtInFunction == "reboot" + || builtInFunction == "restart" + || builtInFunction == "restartapp" + || builtInFunction == "suspend" + || builtInFunction == "hibernate" + || builtInFunction == "quit" + || builtInFunction == "shutdown") + { + return true; + } + } + + return false; +} + +bool CInputManager::ExecuteInputAction(const CAction &action) +{ + bool bResult = false; + + // play sound before the action unless the button is held, + // where we execute after the action as held actions aren't fired every time. + if (action.GetHoldTime()) + { + bResult = g_application.OnAction(action); + if (bResult) + g_audioManager.PlayActionSound(action); + } + else + { + g_audioManager.PlayActionSound(action); + bResult = g_application.OnAction(action); + } + return bResult; +} + +int CInputManager::ExecuteBuiltin(const std::string& execute, const std::vector& params) +{ +#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) + if (execute == "lirc.stop") + { + m_RemoteControl.Disconnect(); + m_RemoteControl.setUsed(false); + } + else if (execute == "lirc.start") + { + m_RemoteControl.setUsed(true); + m_RemoteControl.Initialize(); + } + else if (execute == "lirc.send") + { + std::string command; + for (int i = 0; i < (int)params.size(); i++) + { + command += params[i]; + if (i < (int)params.size() - 1) + command += ' '; + } + m_RemoteControl.AddSendCommand(command); + } + else + return -1; +#endif + return 0; +} + +void CInputManager::SetMouseActive(bool active /* = true */) +{ + m_Mouse.SetActive(active); +} + +void CInputManager::SetMouseEnabled(bool mouseEnabled /* = true */) +{ + m_Mouse.SetEnabled(mouseEnabled); +} + +bool CInputManager::IsMouseActive() +{ + return m_Mouse.IsActive(); +} + +MOUSE_STATE CInputManager::GetMouseState() +{ + return m_Mouse.GetState(); +} + +MousePosition CInputManager::GetMousePosition() +{ + return m_Mouse.GetPosition(); +} + +void CInputManager::SetMouseResolution(int maxX, int maxY, float speedX, float speedY) +{ + m_Mouse.SetResolution(maxX, maxY, speedX, speedY); +} + +void CInputManager::SetMouseState(MOUSE_STATE mouseState) +{ + m_Mouse.SetState(mouseState); +} + +bool CInputManager::IsRemoteControlEnabled() +{ +#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) + return m_RemoteControl.IsInUse(); +#else + return false; +#endif +} + +void CInputManager::EnableRemoteControl() +{ +#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) + m_RemoteControl.setUsed(true); + if (!m_RemoteControl.IsInitialized()) + m_RemoteControl.Initialize(); +#endif +} + +void CInputManager::DisableRemoteControl() +{ +#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) + m_RemoteControl.Disconnect(); + m_RemoteControl.setUsed(false); +#endif +} + +void CInputManager::SetRemoteControlName(const std::string& name) +{ +#if defined(HAS_LIRC) + m_RemoteControl.setDeviceName(name); +#endif +} + +void CInputManager::OnSettingChanged(const CSetting *setting) +{ + if (setting == nullptr) + return; + + const std::string &settingId = setting->GetId(); + if (settingId == "input.enablemouse") + m_Mouse.SetEnabled(dynamic_cast(setting)->GetValue()); + +#if defined(HAS_SDL_JOYSTICK) + if (settingId == "input.enablejoystick") + m_Joystick.SetEnabled(dynamic_cast(setting)->GetValue() && + PERIPHERALS::CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0); +#endif +} diff --git a/xbmc/input/InputManager.h b/xbmc/input/InputManager.h index b157250f5264c..4ae98eba18d9f 100644 --- a/xbmc/input/InputManager.h +++ b/xbmc/input/InputManager.h @@ -21,14 +21,28 @@ #include #include +#include #if defined(TARGET_WINDOWS) #include "input/windows/WINJoystick.h" #elif defined(HAS_SDL_JOYSTICK) || defined(HAS_EVENT_SERVER) #include "input/SDLJoystick.h" #endif +#if defined(HAS_LIRC) +#include "input/linux/LIRC.h" +#endif +#if defined(HAS_IRSERVERSUITE) +#include "input/windows/IRServerSuite.h" +#endif + +#include "windowing/XBMC_events.h" +#include "input/KeyboardStat.h" +#include "input/MouseStat.h" +#include "settings/lib/ISettingCallback.h" + +class CKey; -class CInputManager +class CInputManager : public ISettingCallback { private: CInputManager() { } @@ -36,12 +50,10 @@ class CInputManager CInputManager const& operator=(CInputManager const&); virtual ~CInputManager() { }; - friend class CSettings; - public: /*! \brief static method to get the current instance of the class. Creates a new instance the first time it's called. */ - static CInputManager& GetInstance(); + static CInputManager& Get(); /*! \brief decode an input event from remote controls. @@ -79,8 +91,30 @@ class CInputManager */ bool ProcessPeripherals(float frameTime); + /*! \brief Process all inputs + * + * \param windowId Currently active window + * \param frameTime Time in seconds since last call + * \return true on success, false otherwise + */ + bool Process(int windowId, float frameTime); + + /*! + * \brief Call once during application startup to initialize peripherals that need it + */ + void InitializeInputs(); + + /*! \brief Enable or disable the joystick + * + * \param enabled true to enable joystick, false to disable + * \return void + */ void SetEnabledJoystick(bool enabled = true); + /*! \brief Run joystick initialization again, e.g. a new device is connected + * + * \return void + */ void ReInitializeJoystick(); bool ProcessJoystickEvent(int windowId, const std::string& joystickName, int wKeyID, short inputType, float fAmount, unsigned int holdTime = 0); @@ -89,8 +123,133 @@ class CInputManager void UpdateJoystick(SDL_Event& joyEvent); #endif + /*! \brief Handle an input event + * + * \param newEvent event details + * \return true on succesfully handled event + * \sa XBMC_Event + */ + bool OnEvent(XBMC_Event& newEvent); + + /*! \brief Control if the mouse is actively used or not + * + * \param[in] active sets mouse active or inactive + */ + void SetMouseActive(bool active = true); + + /*! \brief Control if we should use a mouse or not + * + * \param[in] mouseEnabled sets mouse enabled or disabled + */ + void SetMouseEnabled(bool mouseEnabled = true); + + /*! \brief Set the current state of the mouse such as click, drag operation + * + * \param[in] mouseState which state the mouse should be set to + * \sa MOUSE_STATE + */ + void SetMouseState(MOUSE_STATE mouseState); + + /*! \brief Check if the mouse is currently active + * + * \return true if active, false otherwise + */ + bool IsMouseActive(); + + /*! \brief Get the current state of the mouse, such as click or drag operation + * + * \return the current state of the mouse as a value from MOUSE_STATE + * \sa MOUSE_STATE + */ + MOUSE_STATE GetMouseState(); + + /*! \brief Get the current mouse positions x and y coordinates + * + * \return a struct containing the x and y coordinates + * \sa MousePosition + */ + MousePosition GetMousePosition(); + + /*! \brief Set the current screen resolution and pointer speed + * + * \param[in] maxX screen width + * \param[in] maxY screen height + * \param[in] speedX mouse speed in x dimension + * \param[in] speedY mouse speed in y dimension + * \return + */ + void SetMouseResolution(int maxX, int maxY, float speedX, float speedY); + + /*! \brief Enable the remote control + * + */ + void EnableRemoteControl(); + + /*! \brief Disable the remote control + * + */ + void DisableRemoteControl(); + + /*! \brief Check if the remote control is enabled + * + * \return true if remote control is enabled, false otherwise + */ + bool IsRemoteControlEnabled(); + + /*! \brief Set the device name to use with LIRC, does nothing + * if IRServerSuite is used + * + * \param[in] name Name of the device to use with LIRC + */ + void SetRemoteControlName(const std::string& name); + + /*! \brief Parse a builtin command and execute any input action + * currently only LIRC commands implemented + * + * \param[in] execute Command to execute + * \param[in] params parameters that was passed to the command + * \return 0 on success, -1 on failure + */ + int ExecuteBuiltin(const std::string& execute, const std::vector& params); + + virtual void OnSettingChanged(const CSetting *setting); + private: -#ifdef HAS_EVENT_SERVER + + /*! \brief Process keyboard event and translate into an action + * + * \param CKey keypress details + * \return true on succesfully handled event + * \sa CKey + */ + bool OnKey(const CKey& key); + + /*! \brief Determine if an action should be processed or just + * cancel the screensaver + * + * \param action Action that is about to be processed + * \return true on any poweractions such as shutdown/reboot/sleep/suspend, false otherwise + * \sa CAction + */ + bool AlwaysProcess(const CAction& action); + + /*! \brief Send the Action to CApplication for further handling, + * play a sound before or after sending the action. + * + * \param action Action to send to CApplication + * \return result from CApplication::OnAction + * \sa CAction + */ + bool ExecuteInputAction(const CAction &action); + + CKeyboardStat m_Keyboard; + CMouseStat m_Mouse; + +#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) + CRemoteControl m_RemoteControl; +#endif + +#if defined(HAS_EVENT_SERVER) std::map > m_lastAxisMap; #endif diff --git a/xbmc/guilib/Key.cpp b/xbmc/input/Key.cpp similarity index 99% rename from xbmc/guilib/Key.cpp rename to xbmc/input/Key.cpp index cb665e63085df..95a05c85a3ad3 100644 --- a/xbmc/guilib/Key.cpp +++ b/xbmc/input/Key.cpp @@ -19,7 +19,7 @@ */ #include "system.h" -#include "Key.h" +#include "input/Key.h" CKey::CKey(void) { diff --git a/xbmc/guilib/Key.h b/xbmc/input/Key.h similarity index 99% rename from xbmc/guilib/Key.h rename to xbmc/input/Key.h index cd723aacc58de..c4318527dda31 100644 --- a/xbmc/guilib/Key.h +++ b/xbmc/input/Key.h @@ -2,10 +2,6 @@ \file Key.h \brief */ - -#ifndef GUILIB_KEY -#define GUILIB_KEY - #pragma once /* @@ -561,5 +557,3 @@ class CKey }; #endif //undef SWIG -#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..1ef749658acfb 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/Key.h" +#include "input/XBMC_keyboard.h" class CKeyboardStat { @@ -60,6 +63,4 @@ class CKeyboardStat unsigned int m_lastKeyTime; }; -extern CKeyboardStat g_Keyboard; - #endif diff --git a/xbmc/input/Makefile b/xbmc/input/Makefile index 0a9442f94c15d..5bf45894e21a9 100644 --- a/xbmc/input/Makefile +++ b/xbmc/input/Makefile @@ -7,6 +7,7 @@ SRCS=ButtonTranslator.cpp \ SDLJoystick.cpp \ XBMC_keytable.cpp \ InputManager.cpp \ + Key.cpp LIB=input.a diff --git a/xbmc/input/MouseStat.cpp b/xbmc/input/MouseStat.cpp index 8167741a38c19..9ea1a6e95c507 100644 --- a/xbmc/input/MouseStat.cpp +++ b/xbmc/input/MouseStat.cpp @@ -19,7 +19,7 @@ */ #include "MouseStat.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "settings/lib/Setting.h" #include "utils/TimeUtils.h" #include "windowing/WindowingFactory.h" @@ -38,16 +38,6 @@ CMouseStat::~CMouseStat() { } -void CMouseStat::OnSettingChanged(const CSetting *setting) -{ - if (setting == NULL) - return; - - const std::string &settingId = setting->GetId(); - if (settingId == "input.enablemouse") - SetEnabled(((CSettingBool*)setting)->GetValue()); -} - void CMouseStat::Initialize() { // Set the default resolution (PAL) diff --git a/xbmc/input/MouseStat.h b/xbmc/input/MouseStat.h index 1838cd359ea65..900c3a1507cae 100644 --- a/xbmc/input/MouseStat.h +++ b/xbmc/input/MouseStat.h @@ -21,7 +21,6 @@ * */ -#include "settings/lib/ISettingCallback.h" #include "windowing/XBMC_events.h" #define XBMC_BUTTON(X) (1 << ((X)-1)) @@ -44,7 +43,13 @@ #define MOUSE_MAX_BUTTON 5 -enum MOUSE_STATE { MOUSE_STATE_NORMAL = 1, MOUSE_STATE_FOCUS, MOUSE_STATE_DRAG, MOUSE_STATE_CLICK }; +enum MOUSE_STATE +{ + MOUSE_STATE_NORMAL = 1, /*! < Normal state */ + MOUSE_STATE_FOCUS, /*! < Control below the mouse is currently in focus */ + MOUSE_STATE_DRAG, /*! < A drag operation is being performed */ + MOUSE_STATE_CLICK /*! < A mousebutton is being clicked */ +}; enum MOUSE_BUTTON { MOUSE_LEFT_BUTTON = 0, MOUSE_RIGHT_BUTTON, MOUSE_MIDDLE_BUTTON, MOUSE_EXTRA_BUTTON1, MOUSE_EXTRA_BUTTON2 }; // this holds everything we know about the current state of the mouse @@ -59,16 +64,20 @@ struct MouseState bool active; // true if the mouse is active }; +struct MousePosition +{ + int x; + int y; +}; + class CAction; -class CMouseStat : public ISettingCallback +class CMouseStat { public: CMouseStat(); virtual ~CMouseStat(); - virtual void OnSettingChanged(const CSetting *setting); - void Initialize(); void HandleEvent(XBMC_Event& newEvent); void SetResolution(int maxX, int maxY, float speedX, float speedY); @@ -86,6 +95,7 @@ class CMouseStat : public ISettingCallback inline int GetY(void) const { return m_mouseState.y; } inline int GetDX(void) const { return m_mouseState.dx; } inline int GetDY(void) const { return m_mouseState.dy; } + MousePosition GetPosition() { return MousePosition{ m_mouseState.x, m_mouseState.y }; } private: /*! \brief Holds information regarding a particular mouse button state @@ -175,8 +185,6 @@ class CMouseStat : public ISettingCallback uint32_t m_Key; }; -extern CMouseStat g_Mouse; - #endif diff --git a/xbmc/input/SDLJoystick.cpp b/xbmc/input/SDLJoystick.cpp index 306bc93356171..d6e513ff24c5d 100644 --- a/xbmc/input/SDLJoystick.cpp +++ b/xbmc/input/SDLJoystick.cpp @@ -21,7 +21,6 @@ #include "system.h" #include "SDLJoystick.h" #include "input/ButtonTranslator.h" -#include "peripherals/devices/PeripheralImon.h" #include "settings/AdvancedSettings.h" #include "settings/lib/Setting.h" #include "utils/log.h" @@ -42,16 +41,6 @@ CJoystick::CJoystick() Reset(); } -void CJoystick::OnSettingChanged(const CSetting *setting) -{ - if (setting == NULL) - return; - - const std::string &settingId = setting->GetId(); - if (settingId == "input.enablejoystick") - SetEnabled(((CSettingBool*)setting)->GetValue() && PERIPHERALS::CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0); -} - void CJoystick::Reset() { m_AxisIdx = -1; diff --git a/xbmc/input/SDLJoystick.h b/xbmc/input/SDLJoystick.h index ee8488434d31b..02221c880b11b 100644 --- a/xbmc/input/SDLJoystick.h +++ b/xbmc/input/SDLJoystick.h @@ -22,7 +22,6 @@ #define SDL_JOYSTICK_H #include "system.h" // for HAS_SDL_JOYSTICK -#include "settings/lib/ISettingCallback.h" #include #include #include @@ -67,13 +66,11 @@ class CRegExp; // Class to manage all connected joysticks // Note: 'index' always refers to indices specific to this class, // whereas 'ids' always refer to SDL instance id's -class CJoystick : public ISettingCallback +class CJoystick { public: CJoystick(); - virtual void OnSettingChanged(const CSetting *setting); - void Initialize(); void Reset(); void Update(); diff --git a/xbmc/input/linux/LIRC.cpp b/xbmc/input/linux/LIRC.cpp index e167d06171bbb..526dfc645f1a3 100644 --- a/xbmc/input/linux/LIRC.cpp +++ b/xbmc/input/linux/LIRC.cpp @@ -37,8 +37,6 @@ #include "settings/AdvancedSettings.h" #include "utils/TimeUtils.h" -CRemoteControl g_RemoteControl; - CRemoteControl::CRemoteControl(): m_deviceName(LIRC_DEVICE) { diff --git a/xbmc/input/linux/LIRC.h b/xbmc/input/linux/LIRC.h index 386a353b8f11d..7d47edd49d676 100644 --- a/xbmc/input/linux/LIRC.h +++ b/xbmc/input/linux/LIRC.h @@ -65,6 +65,4 @@ class CRemoteControl int m_nrSending; }; -extern CRemoteControl g_RemoteControl; - #endif diff --git a/xbmc/input/touch/generic/GenericTouchActionHandler.cpp b/xbmc/input/touch/generic/GenericTouchActionHandler.cpp index db57c987a05e1..fc8599c9dac2e 100644 --- a/xbmc/input/touch/generic/GenericTouchActionHandler.cpp +++ b/xbmc/input/touch/generic/GenericTouchActionHandler.cpp @@ -21,7 +21,7 @@ #include "GenericTouchActionHandler.h" #include "ApplicationMessenger.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "windowing/WinEvents.h" CGenericTouchActionHandler &CGenericTouchActionHandler::Get() diff --git a/xbmc/input/windows/IRServerSuite.cpp b/xbmc/input/windows/IRServerSuite.cpp index efa0351a6ef29..33fb8a2c11ddb 100644 --- a/xbmc/input/windows/IRServerSuite.cpp +++ b/xbmc/input/windows/IRServerSuite.cpp @@ -29,8 +29,6 @@ #define IRSS_PORT 24000 -CRemoteControl g_RemoteControl; - CRemoteControl::CRemoteControl() : CThread("RemoteControl") { m_socket = INVALID_SOCKET; @@ -75,7 +73,8 @@ void CRemoteControl::Reset() void CRemoteControl::Initialize() { - if (m_isConnecting || m_bInitialized) return; + if (m_isConnecting || m_bInitialized || IsRunning()) + return; //trying to connect when there is nothing to connect to is kinda slow so kick it off in a thread. Create(); } diff --git a/xbmc/input/windows/IRServerSuite.h b/xbmc/input/windows/IRServerSuite.h index a310665c3a25e..d227a3876e4d7 100644 --- a/xbmc/input/windows/IRServerSuite.h +++ b/xbmc/input/windows/IRServerSuite.h @@ -62,5 +62,3 @@ class CRemoteControl : CThread bool HandleRemoteEvent(CIrssMessage& message); }; - -extern CRemoteControl g_RemoteControl; diff --git a/xbmc/input/windows/WINJoystick.cpp b/xbmc/input/windows/WINJoystick.cpp index 7870c4cab9513..1eca28256158a 100644 --- a/xbmc/input/windows/WINJoystick.cpp +++ b/xbmc/input/windows/WINJoystick.cpp @@ -20,7 +20,6 @@ #include "WINJoystick.h" #include "input/ButtonTranslator.h" -#include "peripherals/devices/PeripheralImon.h" #include "settings/AdvancedSettings.h" #include "settings/lib/Setting.h" #include "utils/log.h" @@ -65,16 +64,6 @@ CJoystick::~CJoystick() ReleaseJoysticks(); } -void CJoystick::OnSettingChanged(const CSetting *setting) -{ - if (setting == NULL) - return; - - const std::string &settingId = setting->GetId(); - if (settingId == "input.enablejoystick") - SetEnabled(((CSettingBool*)setting)->GetValue() && PERIPHERALS::CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0); -} - void CJoystick::Reset() { m_AxisIdx = -1; diff --git a/xbmc/input/windows/WINJoystick.h b/xbmc/input/windows/WINJoystick.h index dec177ac8e9fd..84970693ab772 100644 --- a/xbmc/input/windows/WINJoystick.h +++ b/xbmc/input/windows/WINJoystick.h @@ -24,7 +24,6 @@ #include #include #include -#include "settings/lib/ISettingCallback.h" #include "threads/CriticalSection.h" #define JACTIVE_BUTTON 0x00000001 @@ -55,13 +54,12 @@ typedef std::vector AxesConfig; // [HitTest(point)) { // send highlight message - g_Mouse.SetState(MOUSE_STATE_FOCUS); + CInputManager::Get().SetMouseState(MOUSE_STATE_FOCUS); if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { // send mouse message CGUIMessage message(GUI_MSG_FULLSCREEN, CONTROL_LOGO_PIC, GetID()); diff --git a/xbmc/music/dialogs/GUIDialogSongInfo.cpp b/xbmc/music/dialogs/GUIDialogSongInfo.cpp index 906488ab51d1a..d2944546f24f3 100644 --- a/xbmc/music/dialogs/GUIDialogSongInfo.cpp +++ b/xbmc/music/dialogs/GUIDialogSongInfo.cpp @@ -28,7 +28,7 @@ #include "music/windows/GUIWindowMusicBase.h" #include "music/tags/MusicInfoTag.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "filesystem/File.h" #include "filesystem/CurlFile.h" #include "FileItem.h" diff --git a/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp b/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp index a4d098fecb94d..52fa71968ab19 100644 --- a/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp +++ b/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp @@ -23,7 +23,7 @@ #include "guilib/GUIWindowManager.h" #include "GUIUserMessages.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/StringUtils.h" diff --git a/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp b/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp index 2c962ec0ed682..ade5bbc2ba3f2 100644 --- a/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp +++ b/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp @@ -21,7 +21,7 @@ #include "GUIDialogKaraokeSongSelector.h" #include "PlayListPlayer.h" #include "playlists/PlayList.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/log.h" #include "utils/StringUtils.h" diff --git a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp b/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp index 9ac4c0c768ab9..3628f573864f3 100644 --- a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp +++ b/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp @@ -20,7 +20,7 @@ #include "Application.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "settings/AdvancedSettings.h" #include "GUIDialogKaraokeSongSelector.h" diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index 5766a60532f76..c95b6e444712a 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -46,7 +46,7 @@ #include "dialogs/GUIDialogSmartPlaylistEditor.h" #include "music/tags/MusicInfoTag.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIKeyboardFactory.h" diff --git a/xbmc/music/windows/GUIWindowMusicNav.cpp b/xbmc/music/windows/GUIWindowMusicNav.cpp index afd12d3120774..228b814f412e6 100644 --- a/xbmc/music/windows/GUIWindowMusicNav.cpp +++ b/xbmc/music/windows/GUIWindowMusicNav.cpp @@ -38,7 +38,7 @@ #include "guilib/GUIWindowManager.h" #include "dialogs/GUIDialogOK.h" #include "guilib/GUIKeyboardFactory.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIEditControl.h" #include "GUIUserMessages.h" diff --git a/xbmc/music/windows/GUIWindowMusicPlaylist.cpp b/xbmc/music/windows/GUIWindowMusicPlaylist.cpp index 0e2db074da31d..d662e8468d981 100644 --- a/xbmc/music/windows/GUIWindowMusicPlaylist.cpp +++ b/xbmc/music/windows/GUIWindowMusicPlaylist.cpp @@ -29,7 +29,7 @@ #include "music/tags/MusicInfoTag.h" #include "guilib/GUIWindowManager.h" #include "guilib/GUIKeyboardFactory.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "GUIUserMessages.h" #include "ContextMenuManager.h" #include "filesystem/FavouritesDirectory.h" diff --git a/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp b/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp index 115135e62befc..4096413e23f29 100644 --- a/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp +++ b/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp @@ -35,7 +35,7 @@ #include "FileItem.h" #include "settings/Settings.h" #include "GUIUserMessages.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "ContextMenuManager.h" diff --git a/xbmc/music/windows/GUIWindowMusicSongs.cpp b/xbmc/music/windows/GUIWindowMusicSongs.cpp index 4fca036cac08b..e31f538395c3e 100644 --- a/xbmc/music/windows/GUIWindowMusicSongs.cpp +++ b/xbmc/music/windows/GUIWindowMusicSongs.cpp @@ -33,7 +33,7 @@ #include "storage/MediaManager.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/log.h" #include "utils/URIUtils.h" diff --git a/xbmc/music/windows/GUIWindowVisualisation.cpp b/xbmc/music/windows/GUIWindowVisualisation.cpp index 98b034fc2e675..172ba15207c2b 100644 --- a/xbmc/music/windows/GUIWindowVisualisation.cpp +++ b/xbmc/music/windows/GUIWindowVisualisation.cpp @@ -25,7 +25,7 @@ #include "GUIInfoManager.h" #include "music/dialogs/GUIDialogVisualisationPresetList.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "settings/AdvancedSettings.h" #include "settings/Settings.h" diff --git a/xbmc/network/AirPlayServer.cpp b/xbmc/network/AirPlayServer.cpp index 48db9dd7ecf4f..0afc29feb83c9 100644 --- a/xbmc/network/AirPlayServer.cpp +++ b/xbmc/network/AirPlayServer.cpp @@ -40,7 +40,7 @@ #include "utils/md5.h" #include "utils/Variant.h" #include "settings/Settings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "URL.h" #include "cores/IPlayer.h" #include "interfaces/AnnouncementManager.h" diff --git a/xbmc/network/EventClient.cpp b/xbmc/network/EventClient.cpp index d81a56fce19d6..fb28edf61d4c2 100644 --- a/xbmc/network/EventClient.cpp +++ b/xbmc/network/EventClient.cpp @@ -34,7 +34,7 @@ #include "utils/TimeUtils.h" #include "dialogs/GUIDialogKaiToast.h" #include "guilib/GraphicContext.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/StringUtils.h" diff --git a/xbmc/network/EventServer.cpp b/xbmc/network/EventServer.cpp index 66646fe54645f..8bb840427833d 100644 --- a/xbmc/network/EventServer.cpp +++ b/xbmc/network/EventServer.cpp @@ -34,7 +34,7 @@ #include "threads/SingleLock.h" #include "Zeroconf.h" #include "guilib/GUIAudioManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include #include #include diff --git a/xbmc/network/GUIDialogAccessPoints.cpp b/xbmc/network/GUIDialogAccessPoints.cpp index 9edc8b8c6b066..01cd2c575997f 100644 --- a/xbmc/network/GUIDialogAccessPoints.cpp +++ b/xbmc/network/GUIDialogAccessPoints.cpp @@ -25,7 +25,7 @@ #endif #include "Application.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #define CONTROL_ACCESS_POINTS 3 diff --git a/xbmc/network/upnp/UPnP.cpp b/xbmc/network/upnp/UPnP.cpp index 52580577a100b..05ba0111d5e0a 100644 --- a/xbmc/network/upnp/UPnP.cpp +++ b/xbmc/network/upnp/UPnP.cpp @@ -46,7 +46,7 @@ #include "GUIInfoManager.h" #include "utils/TimeUtils.h" #include "video/VideoInfoTag.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "Util.h" using namespace std; diff --git a/xbmc/network/upnp/UPnPPlayer.cpp b/xbmc/network/upnp/UPnPPlayer.cpp index 992a258ed07f7..b3e0df102b597 100644 --- a/xbmc/network/upnp/UPnPPlayer.cpp +++ b/xbmc/network/upnp/UPnPPlayer.cpp @@ -37,7 +37,7 @@ #include "Application.h" #include "dialogs/GUIDialogBusy.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "dialogs/GUIDialogYesNo.h" diff --git a/xbmc/network/upnp/UPnPRenderer.cpp b/xbmc/network/upnp/UPnPRenderer.cpp index 2c84a46d4e969..7a0787314b840 100644 --- a/xbmc/network/upnp/UPnPRenderer.cpp +++ b/xbmc/network/upnp/UPnPRenderer.cpp @@ -29,7 +29,7 @@ #include "filesystem/SpecialProtocol.h" #include "GUIInfoManager.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "pictures/GUIWindowSlideShow.h" #include "pictures/PictureInfoTag.h" #include "interfaces/AnnouncementManager.h" diff --git a/xbmc/osx/OSXTextInputResponder.mm b/xbmc/osx/OSXTextInputResponder.mm index aec7634537215..d0884dbb6ca52 100644 --- a/xbmc/osx/OSXTextInputResponder.mm +++ b/xbmc/osx/OSXTextInputResponder.mm @@ -28,7 +28,7 @@ #include "GUIUserMessages.h" #include "utils/log.h" #include "ApplicationMessenger.h" -#include "guilib/Key.h" +#include "input/Key.h" #undef BOOL void SendKeyboardText(const char *text) diff --git a/xbmc/osx/atv2/KodiController.mm b/xbmc/osx/atv2/KodiController.mm index 1d26a606d77ec..e5f223377dac3 100644 --- a/xbmc/osx/atv2/KodiController.mm +++ b/xbmc/osx/atv2/KodiController.mm @@ -57,7 +57,7 @@ #include "osx/DarwinUtils.h" #include "threads/Event.h" #include "Application.h" -#include "guilib/Key.h" +#include "input/Key.h" #undef BOOL #import diff --git a/xbmc/osx/ios/XBMCController.mm b/xbmc/osx/ios/XBMCController.mm index 8c4e1d565c2ec..063111bad3445 100644 --- a/xbmc/osx/ios/XBMCController.mm +++ b/xbmc/osx/ios/XBMCController.mm @@ -36,7 +36,7 @@ #include "interfaces/AnnouncementManager.h" #include "input/touch/generic/GenericTouchActionHandler.h" #include "guilib/GUIControl.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "windowing/WindowingFactory.h" #include "video/VideoReferenceClock.h" #include "utils/log.h" diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index cf5e7c1d60e5b..f659c21a385f3 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -46,7 +46,7 @@ #include "GUIUserMessages.h" #include "utils/StringUtils.h" #include "Util.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "settings/lib/Setting.h" using namespace PERIPHERALS; diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp index d54e1a3027e38..819177a7258f3 100644 --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp @@ -28,7 +28,7 @@ #include "threads/SingleLock.h" #include "dialogs/GUIDialogKaiToast.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "peripherals/Peripherals.h" #include "peripherals/bus/PeripheralBus.h" diff --git a/xbmc/peripherals/devices/PeripheralImon.cpp b/xbmc/peripherals/devices/PeripheralImon.cpp index 3abe4d822cfa9..5c7f55605778b 100644 --- a/xbmc/peripherals/devices/PeripheralImon.cpp +++ b/xbmc/peripherals/devices/PeripheralImon.cpp @@ -111,7 +111,7 @@ void CPeripheralImon::ActionOnImonConflict(bool deviceInserted /*= true*/) bool enableJoystickNow = !deviceInserted && CSettings::Get().GetBool("input.enablejoystick"); CLog::Log(LOGNOTICE, "Problematic iMON hardware %s. Joystick usage: %s", (deviceInserted ? "detected" : "was removed"), (enableJoystickNow) ? "enabled." : "disabled." ); - CInputManager::GetInstance().SetEnabledJoystick(enableJoystickNow); + CInputManager::Get().SetEnabledJoystick(enableJoystickNow); #endif } } diff --git a/xbmc/peripherals/devices/PeripheralNyxboard.cpp b/xbmc/peripherals/devices/PeripheralNyxboard.cpp index 777111b8b6b78..f5b4b6f478933 100644 --- a/xbmc/peripherals/devices/PeripheralNyxboard.cpp +++ b/xbmc/peripherals/devices/PeripheralNyxboard.cpp @@ -20,7 +20,7 @@ #include "PeripheralNyxboard.h" #include "PeripheralHID.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "utils/log.h" #include "Application.h" diff --git a/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp b/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp index 16b4aed84a0b4..ce2587ea6e54b 100644 --- a/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp +++ b/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp @@ -23,7 +23,7 @@ #include "guilib/GUIWindowManager.h" #include "peripherals/Peripherals.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "utils/log.h" #define BUTTON_CLOSE 10 diff --git a/xbmc/pictures/GUIDialogPictureInfo.cpp b/xbmc/pictures/GUIDialogPictureInfo.cpp index cf86c45c92c26..0a8f6135e0853 100644 --- a/xbmc/pictures/GUIDialogPictureInfo.cpp +++ b/xbmc/pictures/GUIDialogPictureInfo.cpp @@ -22,7 +22,7 @@ #include "GUIInfoManager.h" #include "guilib/GUIWindowManager.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "PictureInfoTag.h" diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp index 5037206e5cf22..4c4162b226b31 100644 --- a/xbmc/pictures/GUIWindowPictures.cpp +++ b/xbmc/pictures/GUIWindowPictures.cpp @@ -32,7 +32,7 @@ #include "playlists/PlayListFactory.h" #include "PictureInfoLoader.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "playlists/PlayList.h" diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp index 4bffed30ebf51..1d34bb32db2a0 100644 --- a/xbmc/pictures/GUIWindowSlideShow.cpp +++ b/xbmc/pictures/GUIWindowSlideShow.cpp @@ -27,7 +27,7 @@ #include "URL.h" #include "guilib/TextureManager.h" #include "guilib/GUILabelControl.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "GUIInfoManager.h" #include "filesystem/Directory.h" #include "GUIDialogPictureInfo.h" diff --git a/xbmc/profiles/ProfilesManager.cpp b/xbmc/profiles/ProfilesManager.cpp index e9b229514b70b..5098fb6987c9f 100644 --- a/xbmc/profiles/ProfilesManager.cpp +++ b/xbmc/profiles/ProfilesManager.cpp @@ -35,7 +35,7 @@ #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "input/ButtonTranslator.h" -#include "input/MouseStat.h" +#include "input/InputManager.h" #include "settings/Settings.h" #if !defined(TARGET_WINDOWS) && defined(HAS_DVD_DRIVE) #include "storage/DetectDVDType.h" @@ -262,7 +262,7 @@ bool CProfilesManager::LoadProfile(size_t index) CDatabaseManager::Get().Initialize(); - g_Mouse.SetEnabled(CSettings::Get().GetBool("input.enablemouse")); + CInputManager::Get().SetMouseEnabled(CSettings::Get().GetBool("input.enablemouse")); g_infoManager.ResetCache(); g_infoManager.ResetLibraryBools(); diff --git a/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp b/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp index 717d74efea57b..8462a28f31b14 100644 --- a/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp +++ b/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp @@ -34,7 +34,7 @@ #include "guilib/GUIWindowManager.h" #include "filesystem/Directory.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" using namespace XFILE; diff --git a/xbmc/programs/GUIWindowPrograms.cpp b/xbmc/programs/GUIWindowPrograms.cpp index 76ba1aa4d2d02..abd995228311d 100644 --- a/xbmc/programs/GUIWindowPrograms.cpp +++ b/xbmc/programs/GUIWindowPrograms.cpp @@ -26,7 +26,7 @@ #include "guilib/GUIWindowManager.h" #include "FileItem.h" #include "settings/MediaSourceSettings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/log.h" #include "utils/StringUtils.h" diff --git a/xbmc/pvr/PVRActionListener.cpp b/xbmc/pvr/PVRActionListener.cpp index 313cd23b614b6..d1e9f106278b5 100644 --- a/xbmc/pvr/PVRActionListener.cpp +++ b/xbmc/pvr/PVRActionListener.cpp @@ -22,7 +22,7 @@ #include "Application.h" #include "ApplicationMessenger.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/GUIWindow.h" #include "guilib/LocalizeStrings.h" #include "guilib/GUIWindowManager.h" diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index d0edc8a9582c8..147377c2217ab 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -59,7 +59,7 @@ #include "timers/PVRTimers.h" #include "interfaces/AnnouncementManager.h" #include "addons/AddonInstaller.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "dialogs/GUIDialogPVRChannelManager.h" #include "dialogs/GUIDialogPVRGroupManager.h" diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp index af91ee470959d..b3af873be9dc8 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp @@ -30,7 +30,7 @@ #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIEditControl.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "profiles/ProfilesManager.h" #include "pvr/PVRManager.h" diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp index b80cc17935055..499f92628e5e5 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp @@ -23,7 +23,7 @@ #include "ApplicationMessenger.h" #include "FileItem.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "dialogs/GUIDialogKaiToast.h" #include "dialogs/GUIDialogOK.h" diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp index 4d7a69521738f..26167df592e5b 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp @@ -24,7 +24,7 @@ #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "guilib/GUIRadioButtonControl.h" #include "utils/StringUtils.h" diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp index 8003da75646ef..1670190d52e2f 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp @@ -22,7 +22,7 @@ #include "FileItem.h" #include "GUIDialogPVRGuideInfo.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "view/ViewState.h" #include "epg/Epg.h" diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp index a2f1ffb31421e..5923a005b16de 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRBase.cpp @@ -28,7 +28,7 @@ #include "dialogs/GUIDialogYesNo.h" #include "dialogs/GUIDialogSelect.h" #include "filesystem/StackDirectory.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/GUIMessage.h" #include "guilib/GUIWindowManager.h" #include "pvr/PVRManager.h" diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp index 071cc29d6027a..7265fc3df3fe5 100644 --- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp @@ -29,7 +29,7 @@ #include "guilib/GUIKeyboardFactory.h" #include "guilib/GUIRadioButtonControl.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "GUIInfoManager.h" #include "pvr/PVRManager.h" #include "pvr/channels/PVRChannelGroupsContainer.h" diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp index 8bd5f78c32044..de23a1b3f3319 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp @@ -25,7 +25,7 @@ #include "GUIUserMessages.h" #include "dialogs/GUIDialogOK.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "pvr/PVRManager.h" #include "pvr/channels/PVRChannelGroupsContainer.h" #include "epg/EpgContainer.h" diff --git a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp index b6ca8c05e2d4f..5fbb581cccd7a 100644 --- a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp @@ -25,7 +25,7 @@ #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIRadioButtonControl.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "GUIInfoManager.h" #include "pvr/PVRManager.h" diff --git a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp index fc0fe3522b9e4..eb03dcabecb06 100644 --- a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp @@ -24,7 +24,7 @@ #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "pvr/PVRManager.h" #include "pvr/channels/PVRChannelGroupsContainer.h" #include "pvr/dialogs/GUIDialogPVRGuideSearch.h" diff --git a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp index bbad1bc4f04e5..9d15479981490 100644 --- a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp @@ -25,7 +25,7 @@ #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "pvr/PVRManager.h" #include "pvr/dialogs/GUIDialogPVRTimerSettings.h" #include "pvr/timers/PVRTimers.h" diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index 996d50c62fc6c..5388ea3b47436 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -37,12 +37,6 @@ #include "guilib/LocalizeStrings.h" #include "guilib/StereoscopicsManager.h" #include "input/KeyboardLayout.h" -#include "input/MouseStat.h" -#if defined(TARGET_WINDOWS) -#include "input/windows/WINJoystick.h" -#elif defined(HAS_SDL_JOYSTICK) -#include "input/SDLJoystick.h" -#endif // defined(HAS_SDL_JOYSTICK) #if defined(TARGET_POSIX) #include "linux/LinuxTimezone.h" #endif // defined(TARGET_POSIX) @@ -271,10 +265,7 @@ void CSettings::Uninitialize() m_settingsManager->UnregisterCallback(&g_charsetConverter); m_settingsManager->UnregisterCallback(&g_graphicsContext); m_settingsManager->UnregisterCallback(&g_langInfo); -#if defined(TARGET_WINDOWS) || defined(HAS_SDL_JOYSTICK) - m_settingsManager->UnregisterCallback(&CInputManager::GetInstance().m_Joystick); -#endif - m_settingsManager->UnregisterCallback(&g_Mouse); + m_settingsManager->UnregisterCallback(&CInputManager::Get()); m_settingsManager->UnregisterCallback(&CNetworkServices::Get()); m_settingsManager->UnregisterCallback(&g_passwordManager); m_settingsManager->UnregisterCallback(&PVR::g_PVRManager); @@ -759,15 +750,10 @@ void CSettings::InitializeISettingCallbacks() settingSet.insert("locale.country"); m_settingsManager->RegisterCallback(&g_langInfo, settingSet); -#if defined(HAS_SDL_JOYSTICK) settingSet.clear(); settingSet.insert("input.enablejoystick"); - m_settingsManager->RegisterCallback(&CInputManager::GetInstance().m_Joystick, settingSet); -#endif - - settingSet.clear(); settingSet.insert("input.enablemouse"); - m_settingsManager->RegisterCallback(&g_Mouse, settingSet); + m_settingsManager->RegisterCallback(&CInputManager::Get(), settingSet); settingSet.clear(); settingSet.insert("services.webserver"); diff --git a/xbmc/settings/dialogs/GUIDialogContentSettings.cpp b/xbmc/settings/dialogs/GUIDialogContentSettings.cpp index d6d22f8140a79..443fb4e5b93f1 100644 --- a/xbmc/settings/dialogs/GUIDialogContentSettings.cpp +++ b/xbmc/settings/dialogs/GUIDialogContentSettings.cpp @@ -27,7 +27,7 @@ #include "filesystem/AddonsDirectory.h" #include "dialogs/GUIDialogKaiToast.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "interfaces/Builtins.h" #include "settings/lib/Setting.h" #include "settings/lib/SettingDependency.h" diff --git a/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp b/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp index 668df0c9c6b0c..588ad4db33a2e 100644 --- a/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp +++ b/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp @@ -31,7 +31,7 @@ #include "guilib/GUISpinControlEx.h" #include "guilib/GUIToggleButtonControl.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "settings/SettingControl.h" #include "settings/lib/SettingSection.h" diff --git a/xbmc/settings/windows/GUIWindowSettingsCategory.cpp b/xbmc/settings/windows/GUIWindowSettingsCategory.cpp index 5f256a25feb6e..6a59378271aed 100644 --- a/xbmc/settings/windows/GUIWindowSettingsCategory.cpp +++ b/xbmc/settings/windows/GUIWindowSettingsCategory.cpp @@ -21,7 +21,7 @@ #include "GUIWindowSettingsCategory.h" #include "GUIPassword.h" #include "GUIUserMessages.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "settings/DisplaySettings.h" #include "settings/Settings.h" #include "settings/lib/SettingSection.h" diff --git a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp index 439fa280916d8..d8e22cbb26328 100644 --- a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp +++ b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp @@ -30,7 +30,7 @@ #include "settings/Settings.h" #include "guilib/GUIWindowManager.h" #include "dialogs/GUIDialogYesNo.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/log.h" #include "utils/StringUtils.h" diff --git a/xbmc/settings/windows/GUIWindowTestPattern.cpp b/xbmc/settings/windows/GUIWindowTestPattern.cpp index 64f36fa46260a..bb9c2968d00c0 100644 --- a/xbmc/settings/windows/GUIWindowTestPattern.cpp +++ b/xbmc/settings/windows/GUIWindowTestPattern.cpp @@ -21,7 +21,7 @@ #include "GUIWindowTestPattern.h" #include "settings/DisplaySettings.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/WindowIDs.h" #include "windowing/WindowingFactory.h" diff --git a/xbmc/storage/AutorunMediaJob.cpp b/xbmc/storage/AutorunMediaJob.cpp index 65bb9b869add6..2b8aeef837c7f 100644 --- a/xbmc/storage/AutorunMediaJob.cpp +++ b/xbmc/storage/AutorunMediaJob.cpp @@ -22,7 +22,7 @@ #include "interfaces/Builtins.h" #include "guilib/GUIWindowManager.h" #include "dialogs/GUIDialogSelect.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "utils/StringUtils.h" CAutorunMediaJob::CAutorunMediaJob(const std::string &label, const std::string &path): diff --git a/xbmc/utils/SeekHandler.h b/xbmc/utils/SeekHandler.h index bae15060374da..e9809651d36da 100644 --- a/xbmc/utils/SeekHandler.h +++ b/xbmc/utils/SeekHandler.h @@ -20,7 +20,7 @@ */ #include -#include "guilib/Key.h" +#include "input/Key.h" #include "interfaces/IActionListener.h" #include "settings/Settings.h" #include "settings/lib/ISettingCallback.h" diff --git a/xbmc/video/PlayerController.cpp b/xbmc/video/PlayerController.cpp index 3f5fc25bdf8b0..31cf7f4cd59b8 100644 --- a/xbmc/video/PlayerController.cpp +++ b/xbmc/video/PlayerController.cpp @@ -25,7 +25,7 @@ #include "settings/MediaSettings.h" #include "settings/Settings.h" #include "cores/IPlayer.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "guilib/GUISliderControl.h" #include "dialogs/GUIDialogKaiToast.h" diff --git a/xbmc/video/PlayerController.h b/xbmc/video/PlayerController.h index de9133f4d0d72..0e4fb64939820 100644 --- a/xbmc/video/PlayerController.h +++ b/xbmc/video/PlayerController.h @@ -21,7 +21,7 @@ */ #include "guilib/ISliderCallback.h" -#include "guilib/Key.h" +#include "input/Key.h" /*! \brief Player controller class to handle user actions. diff --git a/xbmc/video/Teletext.h b/xbmc/video/Teletext.h index 8c26243f8b53b..b7d437aa221a9 100644 --- a/xbmc/video/Teletext.h +++ b/xbmc/video/Teletext.h @@ -21,7 +21,7 @@ */ #include "TeletextDefines.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/GUITexture.h" // stuff for freetype diff --git a/xbmc/video/dialogs/GUIDialogFileStacking.cpp b/xbmc/video/dialogs/GUIDialogFileStacking.cpp index 0207de581222c..b139aabd97785 100644 --- a/xbmc/video/dialogs/GUIDialogFileStacking.cpp +++ b/xbmc/video/dialogs/GUIDialogFileStacking.cpp @@ -19,7 +19,7 @@ */ #include "GUIDialogFileStacking.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "FileItem.h" #include "utils/StringUtils.h" diff --git a/xbmc/video/dialogs/GUIDialogFullScreenInfo.cpp b/xbmc/video/dialogs/GUIDialogFullScreenInfo.cpp index aec13c1112e11..15e0ea0fe6ff6 100644 --- a/xbmc/video/dialogs/GUIDialogFullScreenInfo.cpp +++ b/xbmc/video/dialogs/GUIDialogFullScreenInfo.cpp @@ -19,7 +19,7 @@ */ #include "GUIDialogFullScreenInfo.h" -#include "guilib/Key.h" +#include "input/Key.h" CGUIDialogFullScreenInfo::CGUIDialogFullScreenInfo(void) : CGUIDialog(WINDOW_DIALOG_FULLSCREEN_INFO, "DialogFullScreenInfo.xml") diff --git a/xbmc/video/dialogs/GUIDialogSubtitles.cpp b/xbmc/video/dialogs/GUIDialogSubtitles.cpp index 688a7674ec465..01d050331e05c 100644 --- a/xbmc/video/dialogs/GUIDialogSubtitles.cpp +++ b/xbmc/video/dialogs/GUIDialogSubtitles.cpp @@ -31,7 +31,7 @@ #include "filesystem/SpecialProtocol.h" #include "filesystem/StackDirectory.h" #include "guilib/GUIKeyboardFactory.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "settings/MediaSettings.h" #include "settings/Settings.h" #include "settings/VideoSettings.h" diff --git a/xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp b/xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp index 328974bcbcf0f..6e364bb8011ab 100644 --- a/xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp @@ -39,7 +39,7 @@ #include "guilib/Texture.h" #include "guilib/GUIWindowManager.h" #include "utils/Crc32.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" diff --git a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp index d83844972ed5c..b53d0e3a6d8af 100644 --- a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp @@ -44,7 +44,7 @@ #include "settings/AdvancedSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "ContextMenuManager.h" #include "GUIUserMessages.h" diff --git a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp index d5a9fc1e0205e..22272ece1b356 100644 --- a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp @@ -23,8 +23,8 @@ #include "FileItem.h" #include "GUIUserMessages.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" -#include "input/MouseStat.h" +#include "input/Key.h" +#include "input/InputManager.h" #include "cores/IPlayer.h" #include "pvr/PVRManager.h" @@ -47,7 +47,8 @@ void CGUIDialogVideoOSD::FrameMove() if (m_autoClosing) { // check for movement of mouse or a submenu open - if (g_Mouse.IsActive() || g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS) + if (CInputManager::Get().IsMouseActive() + || g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS) || g_windowManager.IsWindowActive(WINDOW_DIALOG_VIDEO_OSD_SETTINGS) || g_windowManager.IsWindowActive(WINDOW_DIALOG_VIDEO_BOOKMARKS) || g_windowManager.IsWindowActive(WINDOW_DIALOG_PVR_OSD_CHANNELS) diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp index 548b93f9d005d..c861d66ff203c 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.cpp +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp @@ -35,7 +35,7 @@ #include "guilib/GUIFontManager.h" #include "guilib/GUITextLayout.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "video/dialogs/GUIDialogFullScreenInfo.h" #include "dialogs/GUIDialogNumeric.h" #include "settings/DisplaySettings.h" diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index 62ea99550da24..9bdd4ccd18891 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -57,7 +57,7 @@ #include "settings/AdvancedSettings.h" #include "settings/MediaSettings.h" #include "settings/dialogs/GUIDialogContentSettings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/StringUtils.h" #include "utils/log.h" diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index 98dc51043a742..84f39e62fdbe8 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -47,7 +47,7 @@ #include "settings/MediaSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "storage/MediaManager.h" #include "utils/LegacyPathTranslation.h" diff --git a/xbmc/video/windows/GUIWindowVideoPlaylist.cpp b/xbmc/video/windows/GUIWindowVideoPlaylist.cpp index 443a3de774136..477231f7bff72 100644 --- a/xbmc/video/windows/GUIWindowVideoPlaylist.cpp +++ b/xbmc/video/windows/GUIWindowVideoPlaylist.cpp @@ -32,7 +32,7 @@ #include "filesystem/FavouritesDirectory.h" #include "settings/Settings.h" #include "settings/MediaSettings.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/log.h" #include "utils/URIUtils.h" diff --git a/xbmc/view/GUIViewState.cpp b/xbmc/view/GUIViewState.cpp index edc2f9205ca81..e2988a1f9f574 100644 --- a/xbmc/view/GUIViewState.cpp +++ b/xbmc/view/GUIViewState.cpp @@ -41,7 +41,7 @@ #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "filesystem/AddonsDirectory.h" #include "guilib/TextureManager.h" diff --git a/xbmc/windowing/WinEventsSDL.cpp b/xbmc/windowing/WinEventsSDL.cpp index f158b168ed9d1..29f1351b1d648 100644 --- a/xbmc/windowing/WinEventsSDL.cpp +++ b/xbmc/windowing/WinEventsSDL.cpp @@ -28,7 +28,7 @@ #include "GUIUserMessages.h" #include "settings/DisplaySettings.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #ifdef HAS_SDL_JOYSTICK #include "input/SDLJoystick.h" #endif @@ -238,7 +238,7 @@ bool CWinEventsSDL::MessagePump() case SDL_JOYHATMOTION: case SDL_JOYDEVICEADDED: case SDL_JOYDEVICEREMOVED: - CInputManager::GetInstance().UpdateJoystick(event); + CInputManager::Get().UpdateJoystick(event); ret = true; break; #endif @@ -346,7 +346,7 @@ bool CWinEventsSDL::MessagePump() { if (0 == (SDL_GetAppState() & SDL_APPMOUSEFOCUS)) { - g_Mouse.SetActive(false); + CInputManager::Get().SetMouseActive(false); #if defined(TARGET_DARWIN_OSX) // See CApplication::ProcessSlow() for a description as to why we call Cocoa_HideMouse. // this is here to restore the pointer when toggling back to window mode from fullscreen. diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp index 6d6d1f5db4a99..1230b215a9e8c 100644 --- a/xbmc/windowing/WinEventsX11.cpp +++ b/xbmc/windowing/WinEventsX11.cpp @@ -542,7 +542,7 @@ bool CWinEventsX11Imp::MessagePump() // lose mouse coverage case LeaveNotify: { - g_Mouse.SetActive(false); + CInputManager::Get().SetMouseActive(false); break; } @@ -616,7 +616,7 @@ bool CWinEventsX11Imp::MessagePump() case SDL_JOYHATMOTION: case SDL_JOYDEVICEADDED: case SDL_JOYDEVICEREMOVED: - CInputManager::GetInstance().UpdateJoystick(event); + CInputManager::Get().UpdateJoystick(event); ret = true; break; diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp index 347c3ae20e86e..715072451d071 100644 --- a/xbmc/windowing/X11/WinSystemX11.cpp +++ b/xbmc/windowing/X11/WinSystemX11.cpp @@ -46,7 +46,7 @@ #endif #include "../WinEventsX11.h" -#include "input/MouseStat.h" +#include "input/InputManager.h" using namespace std; @@ -993,7 +993,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const std: if (!m_mainWindow) { - g_Mouse.SetActive(false); + CInputManager::Get().SetMouseActive(false); } if (m_mainWindow && ((m_bFullScreen != fullscreen) || m_currentOutput.compare(output) != 0 || m_windowDirty)) @@ -1023,7 +1023,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const std: } } - g_Mouse.SetActive(false); + CInputManager::Get().SetMouseActive(false); OnLostDevice(); DestroyWindow(); m_windowDirty = true; diff --git a/xbmc/windowing/android/WinEventsAndroid.cpp b/xbmc/windowing/android/WinEventsAndroid.cpp index b6402434e8707..fcbbcea822fdf 100644 --- a/xbmc/windowing/android/WinEventsAndroid.cpp +++ b/xbmc/windowing/android/WinEventsAndroid.cpp @@ -220,7 +220,7 @@ bool CWinEventsAndroid::MessagePump() if (fabs(amount) >= ALMOST_ZERO) { - ret |= CInputManager::GetInstance().ProcessJoystickEvent(g_windowManager.GetActiveWindowID(), + ret |= CInputManager::Get().ProcessJoystickEvent(g_windowManager.GetActiveWindowID(), input_device.name, item, input_type, amount, holdTime); } } diff --git a/xbmc/windowing/osx/WinEventsIOS.mm b/xbmc/windowing/osx/WinEventsIOS.mm index 4272a25cc7606..988f4428c3227 100644 --- a/xbmc/windowing/osx/WinEventsIOS.mm +++ b/xbmc/windowing/osx/WinEventsIOS.mm @@ -71,7 +71,7 @@ unsigned int holdTime = pumpEvent.jbutton.holdTime; CLog::Log(LOGDEBUG,"CWinEventsIOS: Button press keyID = %i", wKeyID); - ret |= CInputManager::GetInstance().ProcessJoystickEvent(g_windowManager.GetActiveWindowID(), joystickName, wKeyID, JACTIVE_BUTTON, fAmount, holdTime); + ret |= CInputManager::Get().ProcessJoystickEvent(g_windowManager.GetActiveWindowID(), joystickName, wKeyID, JACTIVE_BUTTON, fAmount, holdTime); } else ret |= g_application.OnEvent(pumpEvent); diff --git a/xbmc/windowing/windows/WinEventsWin32.cpp b/xbmc/windowing/windows/WinEventsWin32.cpp index 1e8fc086ca7d9..7e633eb7c72a4 100644 --- a/xbmc/windowing/windows/WinEventsWin32.cpp +++ b/xbmc/windowing/windows/WinEventsWin32.cpp @@ -455,7 +455,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L case WM_ACTIVATE: { if( WA_INACTIVE != wParam ) - CInputManager::GetInstance().ReInitializeJoystick(); + CInputManager::Get().ReInitializeJoystick(); bool active = g_application.GetRenderGUI(); if (HIWORD(wParam)) @@ -761,7 +761,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L if (((_DEV_BROADCAST_HEADER*) lParam)->dbcd_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { g_peripherals.TriggerDeviceScan(PERIPHERAL_BUS_USB); - CInputManager::GetInstance().ReInitializeJoystick(); + CInputManager::Get().ReInitializeJoystick(); } // check if an usb or optical media was inserted or removed if (((_DEV_BROADCAST_HEADER*) lParam)->dbcd_devicetype == DBT_DEVTYP_VOLUME) diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index 0ba87b005656b..9d7d5db7bc6e1 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -53,7 +53,7 @@ #include "video/VideoLibraryQueue.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "utils/TimeUtils.h" #include "filesystem/File.h" diff --git a/xbmc/windows/GUIWindowFileManager.cpp b/xbmc/windows/GUIWindowFileManager.cpp index 8421af925b7ea..97476b1a0a921 100644 --- a/xbmc/windows/GUIWindowFileManager.cpp +++ b/xbmc/windows/GUIWindowFileManager.cpp @@ -35,7 +35,7 @@ #include "playlists/PlayListFactory.h" #include "network/Network.h" #include "guilib/GUIWindowManager.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIKeyboardFactory.h" @@ -48,7 +48,7 @@ #include "settings/AdvancedSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" -#include "input/MouseStat.h" +#include "input/InputManager.h" #include "guilib/LocalizeStrings.h" #include "utils/StringUtils.h" #include "utils/log.h" @@ -293,7 +293,7 @@ bool CGUIWindowFileManager::OnMessage(CGUIMessage& message) if (iAction == ACTION_HIGHLIGHT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK) { OnMark(list, iItem); - if (!g_Mouse.IsActive()) + if (!CInputManager::Get().IsMouseActive()) { //move to next item CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), iControl, iItem + 1); diff --git a/xbmc/windows/GUIWindowHome.cpp b/xbmc/windows/GUIWindowHome.cpp index a82446cbb948c..9020f06b675d3 100644 --- a/xbmc/windows/GUIWindowHome.cpp +++ b/xbmc/windows/GUIWindowHome.cpp @@ -19,7 +19,7 @@ */ #include "GUIWindowHome.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/WindowIDs.h" #include "utils/JobManager.h" #include "utils/RecentlyAddedJob.h" diff --git a/xbmc/windows/GUIWindowLoginScreen.cpp b/xbmc/windows/GUIWindowLoginScreen.cpp index b3108ac8ff8fe..e56e0dddd7f09 100644 --- a/xbmc/windows/GUIWindowLoginScreen.cpp +++ b/xbmc/windows/GUIWindowLoginScreen.cpp @@ -43,7 +43,7 @@ #include "dialogs/GUIDialogOK.h" #include "settings/Settings.h" #include "FileItem.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "addons/AddonManager.h" #include "view/ViewState.h" diff --git a/xbmc/windows/GUIWindowPointer.cpp b/xbmc/windows/GUIWindowPointer.cpp index eb12cf96b1b49..98dc7c4c3b873 100644 --- a/xbmc/windows/GUIWindowPointer.cpp +++ b/xbmc/windows/GUIWindowPointer.cpp @@ -20,6 +20,7 @@ #include "GUIWindowPointer.h" #include "input/MouseStat.h" +#include "input/InputManager.h" #include "windowing/WindowingFactory.h" #include #define ID_POINTER 10 @@ -58,7 +59,7 @@ void CGUIWindowPointer::UpdateVisibility() { if(g_Windowing.HasCursor()) { - if (g_Mouse.IsActive()) + if (CInputManager::Get().IsMouseActive()) Show(); else Close(); @@ -80,13 +81,14 @@ void CGUIWindowPointer::OnWindowLoaded() void CGUIWindowPointer::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) { - bool active = g_Mouse.IsActive(); + bool active = CInputManager::Get().IsMouseActive(); if (active != m_active) { MarkDirtyRegion(); m_active = active; } - SetPosition((float)g_Mouse.GetX(), (float)g_Mouse.GetY()); - SetPointer(g_Mouse.GetState()); + MousePosition pos = CInputManager::Get().GetMousePosition(); + SetPosition((float)pos.x, (float)pos.y); + SetPointer(CInputManager::Get().GetMouseState()); return CGUIWindow::Process(currentTime, dirtyregions); } diff --git a/xbmc/windows/GUIWindowStartup.cpp b/xbmc/windows/GUIWindowStartup.cpp index 5263f19742815..7d9380ee2e835 100644 --- a/xbmc/windows/GUIWindowStartup.cpp +++ b/xbmc/windows/GUIWindowStartup.cpp @@ -19,7 +19,7 @@ */ #include "GUIWindowStartup.h" -#include "guilib/Key.h" +#include "input/Key.h" #include "guilib/WindowIDs.h" CGUIWindowStartup::CGUIWindowStartup(void)