Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

jsonrpc: cleanup CInputOperations to use actions instead of virtual keys

  • Loading branch information...
commit b6db266119aa38424a25b1136f073b8350037dda 1 parent d6be53a
@Montellese Montellese authored
View
27 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
View
1  xbmc/Application.h
@@ -446,7 +446,6 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
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);
View
36 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 &parameterObject, CVariant &result)
{
- return SendKey(XBMCVK_LEFT);
+ return SendAction(ACTION_MOVE_LEFT);
}
JSONRPC_STATUS CInputOperations::Right(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
- return SendKey(XBMCVK_RIGHT);
+ return SendAction(ACTION_MOVE_RIGHT);
}
JSONRPC_STATUS CInputOperations::Down(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
- return SendKey(XBMCVK_DOWN);
+ return SendAction(ACTION_MOVE_DOWN);
}
JSONRPC_STATUS CInputOperations::Up(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
- return SendKey(XBMCVK_UP);
+ return SendAction(ACTION_MOVE_UP);
}
JSONRPC_STATUS CInputOperations::Select(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
- return SendKey(XBMCVK_RETURN);
+ return SendAction(ACTION_SELECT_ITEM);
}
JSONRPC_STATUS CInputOperations::Back(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
- return SendKey(XBMCVK_BACK);
+ return SendAction(ACTION_NAV_BACK);
}
JSONRPC_STATUS CInputOperations::ContextMenu(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
View
6 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 &parameterObject, CVariant &result);
static JSONRPC_STATUS ExecuteAction(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
@@ -48,14 +46,10 @@ namespace JSONRPC
static JSONRPC_STATUS ShowCodec(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS ShowOSD(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, 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;
};
}

0 comments on commit b6db266

Please sign in to comment.
Something went wrong with that request. Please try again.