Guest User

Untitled

a guest
Jan 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.89 KB | None | 0 0
  1. From b6db266119aa38424a25b1136f073b8350037dda Mon Sep 17 00:00:00 2001
  2. From: montellese <montellese@xbmc.org>
  3. Date: Mon, 15 Oct 2012 00:23:31 +0200
  4. Subject: [PATCH] jsonrpc: cleanup CInputOperations to use actions instead of
  5.  virtual keys
  6.  
  7. ---
  8. xbmc/Application.cpp                         |   27 -------------------
  9.  xbmc/Application.h                           |    1 -
  10.  xbmc/interfaces/json-rpc/InputOperations.cpp |   36 +++++---------------------
  11.  xbmc/interfaces/json-rpc/InputOperations.h   |    6 -----
  12.  4 files changed, 6 insertions(+), 64 deletions(-)
  13.  
  14. diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
  15. index 7563160..8a0976e 100644
  16. --- a/xbmc/Application.cpp
  17. +++ b/xbmc/Application.cpp
  18. @@ -148,9 +148,6 @@
  19.  #ifdef HAS_EVENT_SERVER
  20.  #include "network/EventServer.h"
  21.  #endif
  22. -#ifdef HAS_JSONRPC
  23. -#include "interfaces/json-rpc/InputOperations.h"
  24. -#endif
  25.  #ifdef HAS_DBUS
  26.  #include <dbus/dbus.h>
  27.  #endif
  28. @@ -2949,7 +2946,6 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
  29.  #endif
  30.  
  31.      // process input actions
  32. -    ProcessJsonRpcButtons();
  33.      ProcessRemote(frameTime);
  34.      ProcessGamepad(frameTime);
  35.      ProcessEventServer(frameTime);
  36. @@ -3142,29 +3138,6 @@ bool CApplication::ProcessMouse()
  37.                            mouseaction.GetName()));
  38.  }
  39.  
  40. -bool CApplication::ProcessJsonRpcButtons()
  41. -{
  42. -#ifdef HAS_JSONRPC
  43. -  CKey tempKey(JSONRPC::CInputOperations::GetKey());
  44. -  if (tempKey.GetButtonCode() == KEY_UNICODE && tempKey.GetUnicode() != 0)
  45. -  {
  46. -    XBMC_Event event = { 0 };
  47. -    event.type = XBMC_KEYDOWN;
  48. -    event.key.type = XBMC_KEYDOWN;
  49. -    event.key.keysym.unicode = (uint16_t)tempKey.GetUnicode();
  50. -    event.key.keysym.sym = (XBMCKey)tempKey.GetUnicode();
  51. -
  52. -    return OnEvent(event);
  53. -  }
  54. -  if (tempKey.GetButtonCode() != KEY_INVALID)
  55. -  {
  56. -    tempKey.SetFromService(true);
  57. -    return OnKey(tempKey);
  58. -  }
  59. -#endif
  60. -  return false;
  61. -}
  62. -
  63.  bool CApplication::ProcessEventServer(float frameTime)
  64.  {
  65.  #ifdef HAS_EVENT_SERVER
  66. diff --git a/xbmc/Application.h b/xbmc/Application.h
  67. index 58b093a..650fc87 100644
  68. --- a/xbmc/Application.h
  69. +++ b/xbmc/Application.h
  70. @@ -446,7 +446,6 @@ protected:
  71.    bool ProcessGamepad(float frameTime);
  72.    bool ProcessEventServer(float frameTime);
  73.    bool ProcessPeripherals(float frameTime);
  74. -  bool ProcessJsonRpcButtons();
  75.    bool ProcessJoystickEvent(const std::string& joystickName, int button, bool isAxis, float fAmount, unsigned int holdTime = 0);
  76.    int  GetActiveWindowID(void);
  77.  
  78. diff --git a/xbmc/interfaces/json-rpc/InputOperations.cpp b/xbmc/interfaces/json-rpc/InputOperations.cpp
  79. index 9a1d593..39cade0 100644
  80. --- a/xbmc/interfaces/json-rpc/InputOperations.cpp
  81. +++ b/xbmc/interfaces/json-rpc/InputOperations.cpp
  82. @@ -32,17 +32,6 @@
  83.  
  84.  using namespace JSONRPC;
  85.  
  86. -CCriticalSection CInputOperations::m_critSection;
  87. -CKey CInputOperations::m_key(KEY_INVALID);
  88. -
  89. -CKey CInputOperations::GetKey()
  90. -{
  91. -  CSingleLock lock(m_critSection);
  92. -  CKey currentKey = m_key;
  93. -  m_key = CKey(KEY_INVALID);
  94. -  return currentKey;
  95. -}
  96. -
  97.  //TODO the breakage of the screensaver should be refactored
  98.  //to one central super duper place for getting rid of
  99.  //1 million dupes
  100. @@ -60,19 +49,6 @@ bool CInputOperations::handleScreenSaver()
  101.    return screenSaverBroken;
  102.  }
  103.  
  104. -JSONRPC_STATUS CInputOperations::SendKey(uint32_t keyCode, bool unicode /* = false */)
  105. -{
  106. -  if (keyCode == KEY_INVALID)
  107. -    return InternalError;
  108. -
  109. -  CSingleLock lock(m_critSection);
  110. -  if (unicode)
  111. -    m_key = CKey(0, (wchar_t)keyCode, 0, 0, 0);
  112. -  else
  113. -    m_key = CKey(keyCode | KEY_VKEY);
  114. -  return ACK;
  115. -}
  116. -
  117.  JSONRPC_STATUS CInputOperations::SendAction(int actionID, bool wakeScreensaver /* = true */, bool waitResult /* = false */)
  118.  {
  119.    if(!wakeScreensaver || !handleScreenSaver())
  120. @@ -116,32 +92,32 @@ JSONRPC_STATUS CInputOperations::ExecuteAction(const CStdString &method, ITransp
  121.  
  122.  JSONRPC_STATUS CInputOperations::Left(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
  123.  {
  124. -  return SendKey(XBMCVK_LEFT);
  125. +  return SendAction(ACTION_MOVE_LEFT);
  126.  }
  127.  
  128.  JSONRPC_STATUS CInputOperations::Right(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
  129.  {
  130. -  return SendKey(XBMCVK_RIGHT);
  131. +  return SendAction(ACTION_MOVE_RIGHT);
  132.  }
  133.  
  134.  JSONRPC_STATUS CInputOperations::Down(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
  135.  {
  136. -  return SendKey(XBMCVK_DOWN);
  137. +  return SendAction(ACTION_MOVE_DOWN);
  138.  }
  139.  
  140.  JSONRPC_STATUS CInputOperations::Up(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
  141.  {
  142. -  return SendKey(XBMCVK_UP);
  143. +  return SendAction(ACTION_MOVE_UP);
  144.  }
  145.  
  146.  JSONRPC_STATUS CInputOperations::Select(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
  147.  {
  148. -  return SendKey(XBMCVK_RETURN);
  149. +  return SendAction(ACTION_SELECT_ITEM);
  150.  }
  151.  
  152.  JSONRPC_STATUS CInputOperations::Back(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
  153.  {
  154. -  return SendKey(XBMCVK_BACK);
  155. +  return SendAction(ACTION_NAV_BACK);
  156.  }
  157.  
  158.  JSONRPC_STATUS CInputOperations::ContextMenu(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
  159. diff --git a/xbmc/interfaces/json-rpc/InputOperations.h b/xbmc/interfaces/json-rpc/InputOperations.h
  160. index 26c96fa..a17585f 100644
  161. --- a/xbmc/interfaces/json-rpc/InputOperations.h
  162. +++ b/xbmc/interfaces/json-rpc/InputOperations.h
  163. @@ -29,8 +29,6 @@ namespace JSONRPC
  164.    class CInputOperations
  165.    {
  166.    public:
  167. -    static CKey GetKey();
  168. -
  169.      static JSONRPC_STATUS SendText(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
  170.      static JSONRPC_STATUS ExecuteAction(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
  171.  
  172. @@ -48,14 +46,10 @@ namespace JSONRPC
  173.      static JSONRPC_STATUS ShowCodec(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
  174.      static JSONRPC_STATUS ShowOSD(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
  175.  
  176. -    static JSONRPC_STATUS SendKey(uint32_t keyCode, bool unicode = false);
  177.      static JSONRPC_STATUS SendAction(int actionID, bool wakeScreensaver = true, bool waitResult = false);
  178.  
  179.    private:
  180.      static JSONRPC_STATUS activateWindow(int windowID);
  181.      static bool        handleScreenSaver();
  182. -
  183. -    static CCriticalSection m_critSection;
  184. -    static CKey m_key;
  185.    };
  186.  }
  187. --
  188. 1.7.9.5
Add Comment
Please, Sign In to add comment