Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From b6db266119aa38424a25b1136f073b8350037dda Mon Sep 17 00:00:00 2001
- From: montellese <montellese@xbmc.org>
- Date: Mon, 15 Oct 2012 00:23:31 +0200
- Subject: [PATCH] jsonrpc: cleanup CInputOperations to use actions instead of
- virtual keys
- ---
- xbmc/Application.cpp | 27 -------------------
- xbmc/Application.h | 1 -
- xbmc/interfaces/json-rpc/InputOperations.cpp | 36 +++++---------------------
- xbmc/interfaces/json-rpc/InputOperations.h | 6 -----
- 4 files changed, 6 insertions(+), 64 deletions(-)
- diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
- index 7563160..8a0976e 100644
- --- a/xbmc/Application.cpp
- +++ b/xbmc/Application.cpp
- @@ -148,9 +148,6 @@
- #ifdef HAS_EVENT_SERVER
- #include "network/EventServer.h"
- #endif
- -#ifdef HAS_JSONRPC
- -#include "interfaces/json-rpc/InputOperations.h"
- -#endif
- #ifdef HAS_DBUS
- #include <dbus/dbus.h>
- #endif
- @@ -2949,7 +2946,6 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
- #endif
- // process input actions
- - ProcessJsonRpcButtons();
- ProcessRemote(frameTime);
- ProcessGamepad(frameTime);
- ProcessEventServer(frameTime);
- @@ -3142,29 +3138,6 @@ bool CApplication::ProcessMouse()
- mouseaction.GetName()));
- }
- -bool CApplication::ProcessJsonRpcButtons()
- -{
- -#ifdef HAS_JSONRPC
- - CKey tempKey(JSONRPC::CInputOperations::GetKey());
- - if (tempKey.GetButtonCode() == KEY_UNICODE && tempKey.GetUnicode() != 0)
- - {
- - XBMC_Event event = { 0 };
- - event.type = XBMC_KEYDOWN;
- - event.key.type = XBMC_KEYDOWN;
- - event.key.keysym.unicode = (uint16_t)tempKey.GetUnicode();
- - event.key.keysym.sym = (XBMCKey)tempKey.GetUnicode();
- -
- - return OnEvent(event);
- - }
- - if (tempKey.GetButtonCode() != KEY_INVALID)
- - {
- - tempKey.SetFromService(true);
- - return OnKey(tempKey);
- - }
- -#endif
- - return false;
- -}
- -
- bool CApplication::ProcessEventServer(float frameTime)
- {
- #ifdef HAS_EVENT_SERVER
- diff --git a/xbmc/Application.h b/xbmc/Application.h
- index 58b093a..650fc87 100644
- --- a/xbmc/Application.h
- +++ b/xbmc/Application.h
- @@ -446,7 +446,6 @@ protected:
- bool ProcessGamepad(float frameTime);
- bool ProcessEventServer(float frameTime);
- bool ProcessPeripherals(float frameTime);
- - bool ProcessJsonRpcButtons();
- bool ProcessJoystickEvent(const std::string& joystickName, int button, bool isAxis, float fAmount, unsigned int holdTime = 0);
- int GetActiveWindowID(void);
- diff --git a/xbmc/interfaces/json-rpc/InputOperations.cpp b/xbmc/interfaces/json-rpc/InputOperations.cpp
- index 9a1d593..39cade0 100644
- --- a/xbmc/interfaces/json-rpc/InputOperations.cpp
- +++ b/xbmc/interfaces/json-rpc/InputOperations.cpp
- @@ -32,17 +32,6 @@
- using namespace JSONRPC;
- -CCriticalSection CInputOperations::m_critSection;
- -CKey CInputOperations::m_key(KEY_INVALID);
- -
- -CKey CInputOperations::GetKey()
- -{
- - CSingleLock lock(m_critSection);
- - CKey currentKey = m_key;
- - m_key = CKey(KEY_INVALID);
- - return currentKey;
- -}
- -
- //TODO the breakage of the screensaver should be refactored
- //to one central super duper place for getting rid of
- //1 million dupes
- @@ -60,19 +49,6 @@ bool CInputOperations::handleScreenSaver()
- return screenSaverBroken;
- }
- -JSONRPC_STATUS CInputOperations::SendKey(uint32_t keyCode, bool unicode /* = false */)
- -{
- - if (keyCode == KEY_INVALID)
- - return InternalError;
- -
- - CSingleLock lock(m_critSection);
- - if (unicode)
- - m_key = CKey(0, (wchar_t)keyCode, 0, 0, 0);
- - else
- - m_key = CKey(keyCode | KEY_VKEY);
- - return ACK;
- -}
- -
- JSONRPC_STATUS CInputOperations::SendAction(int actionID, bool wakeScreensaver /* = true */, bool waitResult /* = false */)
- {
- if(!wakeScreensaver || !handleScreenSaver())
- @@ -116,32 +92,32 @@ JSONRPC_STATUS CInputOperations::ExecuteAction(const CStdString &method, ITransp
- JSONRPC_STATUS CInputOperations::Left(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
- {
- - return SendKey(XBMCVK_LEFT);
- + return SendAction(ACTION_MOVE_LEFT);
- }
- JSONRPC_STATUS CInputOperations::Right(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
- {
- - return SendKey(XBMCVK_RIGHT);
- + return SendAction(ACTION_MOVE_RIGHT);
- }
- JSONRPC_STATUS CInputOperations::Down(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
- {
- - return SendKey(XBMCVK_DOWN);
- + return SendAction(ACTION_MOVE_DOWN);
- }
- JSONRPC_STATUS CInputOperations::Up(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
- {
- - return SendKey(XBMCVK_UP);
- + return SendAction(ACTION_MOVE_UP);
- }
- JSONRPC_STATUS CInputOperations::Select(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
- {
- - return SendKey(XBMCVK_RETURN);
- + return SendAction(ACTION_SELECT_ITEM);
- }
- JSONRPC_STATUS CInputOperations::Back(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
- {
- - return SendKey(XBMCVK_BACK);
- + return SendAction(ACTION_NAV_BACK);
- }
- JSONRPC_STATUS CInputOperations::ContextMenu(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
- diff --git a/xbmc/interfaces/json-rpc/InputOperations.h b/xbmc/interfaces/json-rpc/InputOperations.h
- index 26c96fa..a17585f 100644
- --- a/xbmc/interfaces/json-rpc/InputOperations.h
- +++ b/xbmc/interfaces/json-rpc/InputOperations.h
- @@ -29,8 +29,6 @@ namespace JSONRPC
- class CInputOperations
- {
- public:
- - static CKey GetKey();
- -
- static JSONRPC_STATUS SendText(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result);
- static JSONRPC_STATUS ExecuteAction(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result);
- @@ -48,14 +46,10 @@ namespace JSONRPC
- static JSONRPC_STATUS ShowCodec(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result);
- static JSONRPC_STATUS ShowOSD(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result);
- - static JSONRPC_STATUS SendKey(uint32_t keyCode, bool unicode = false);
- static JSONRPC_STATUS SendAction(int actionID, bool wakeScreensaver = true, bool waitResult = false);
- private:
- static JSONRPC_STATUS activateWindow(int windowID);
- static bool handleScreenSaver();
- -
- - static CCriticalSection m_critSection;
- - static CKey m_key;
- };
- }
- --
- 1.7.9.5
Add Comment
Please, Sign In to add comment