diff options
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PythonKeyboard.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PythonKeyboard.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp index 46c43b5e339..f83b23f510c 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp @@ -28,6 +28,8 @@ #include "SCA_PythonKeyboard.h" #include "SCA_IInputDevice.h" +#include "GHOST_C-api.h" + /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ @@ -55,6 +57,23 @@ SCA_PythonKeyboard::~SCA_PythonKeyboard() /* Python functions */ /* ------------------------------------------------------------------------- */ +/* clipboard */ +static PyObject* gPyGetClipboard(PyObject* args, PyObject* kwds) +{ + char *buf = (char *)GHOST_getClipboard(0); + return PyUnicode_FromString(buf?buf:""); +} + +static PyObject* gPySetClipboard(PyObject* args, PyObject* value) +{ + char* buf; + if (!PyArg_ParseTuple(value,"s:setClipboard",&buf)) + Py_RETURN_NONE; + + GHOST_putClipboard((GHOST_TInt8 *)buf, 0); + Py_RETURN_NONE; +} + /* Integration hooks ------------------------------------------------------- */ PyTypeObject SCA_PythonKeyboard::Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -79,6 +98,8 @@ PyTypeObject SCA_PythonKeyboard::Type = { }; PyMethodDef SCA_PythonKeyboard::Methods[] = { + {"getClipboard", (PyCFunction) gPyGetClipboard, METH_VARARGS, "getCliboard doc"}, + {"setClipboard", (PyCFunction) gPySetClipboard, METH_VARARGS, "setCliboard doc"}, {NULL,NULL} //Sentinel }; |