diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 575ee39aa..b9402d970 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -39,12 +39,18 @@ CInput::CInput() m_InputCounter = 1; m_InputGrabbed = 0; + m_pClipboardText = 0; m_MouseDoubleClick = false; m_NumEvents = 0; } +CInput::~CInput() +{ + free(m_pClipboardText); +} + void CInput::Init() { m_pGraphics = Kernel()->RequestInterface(); @@ -103,6 +109,21 @@ int CInput::MouseDoubleClick() return 0; } +const char *CInput::GetClipboardText() +{ + if(m_pClipboardText) + { + free(m_pClipboardText); + } + m_pClipboardText = SDL_GetClipboardText(); + return m_pClipboardText; +} + +void CInput::SetClipboardText(const char *pText) +{ + SDL_SetClipboardText(pText); +} + void CInput::Clear() { mem_zero(m_aInputState, sizeof(m_aInputState)); diff --git a/src/engine/client/input.h b/src/engine/client/input.h index d71ade5e7..6d6febffc 100644 --- a/src/engine/client/input.h +++ b/src/engine/client/input.h @@ -9,6 +9,7 @@ class CInput : public IEngineInput IConsole *m_pConsole; int m_InputGrabbed; + char *m_pClipboardText; bool m_MouseDoubleClick; @@ -28,6 +29,7 @@ class CInput : public IEngineInput public: CInput(); + ~CInput(); virtual void Init(); @@ -38,6 +40,8 @@ public: virtual void MouseModeAbsolute(); virtual void MouseModeRelative(); virtual int MouseDoubleClick(); + virtual const char *GetClipboardText(); + virtual void SetClipboardText(const char *pText); virtual int Update(); }; diff --git a/src/engine/input.h b/src/engine/input.h index 256dfd831..d26d859fd 100644 --- a/src/engine/input.h +++ b/src/engine/input.h @@ -63,6 +63,9 @@ public: virtual void MouseModeRelative() = 0; virtual void MouseModeAbsolute() = 0; virtual int MouseDoubleClick() = 0; + virtual const char* GetClipboardText() = 0; + virtual void SetClipboardText(const char *Text) = 0; + virtual void MouseRelative(float *x, float *y) = 0; };