void WM_clipboard_text_set(char *buf, int selection) { if (!G.background) { #ifdef _WIN32 /* do conversion from \n to \r\n on Windows */ char *p, *p2, *newbuf; int newlen = 0; for (p = buf; *p; p++) { if (*p == '\n') newlen += 2; else newlen++; } newbuf = MEM_callocN(newlen + 1, "WM_clipboard_text_set"); for (p = buf, p2 = newbuf; *p; p++, p2++) { if (*p == '\n') { *(p2++) = '\r'; *p2 = '\n'; } else *p2 = *p; } *p2 = '\0'; GHOST_putClipboard((GHOST_TInt8 *)newbuf, selection); MEM_freeN(newbuf); #else GHOST_putClipboard((GHOST_TInt8 *)buf, selection); #endif } }
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; }