Index: source/blender/src/drawtext.c =================================================================== --- source/blender/src/drawtext.c (revision 13585) +++ source/blender/src/drawtext.c (working copy) @@ -45,6 +45,10 @@ #include #include "BLI_winstuff.h" #endif +#ifdef __linux__ +#include +#include +#endif #include "MEM_guardedalloc.h" #include "PIL_time.h" @@ -1354,6 +1358,46 @@ MEM_freeN(buffer); } #endif +#ifdef __linux__ + Display *dpy = NULL; + Window Sown; + Atom type; + int format; + unsigned long len, bytes, dummy; + unsigned char *data = NULL; + + dpy = XOpenDisplay(NULL); + if(dpy == NULL) { return;} + + XFlush(dpy); + Sown = XGetSelectionOwner (dpy, XA_PRIMARY); //Primary selection + + if (Sown != None) { + XConvertSelection (dpy, XA_PRIMARY, XA_STRING, None, Sown, CurrentTime); + XFlush(dpy); + sleep(1); //Sleep to wait for the Convert + XGetWindowProperty (dpy, Sown, XA_STRING, 0, 0, 0, AnyPropertyType, &type, &format, &len, &bytes, &data); + + if(bytes > 0) { + if(XGetWindowProperty (dpy, Sown, XA_STRING, 0, bytes, 0, AnyPropertyType, &type, &format, &len, &dummy, &data) == Success) { + txt_insert_buf(text, data); + } + } else { + XConvertSelection (dpy, XA_PRIMARY, XA_STRING, XA_CUT_BUFFER0, Sown, CurrentTime); + XFlush(dpy); + sleep(1); + XGetWindowProperty (dpy, Sown, XA_CUT_BUFFER0, 0, 0, 0, AnyPropertyType, &type, &format, &len, &bytes, &data); + + if(bytes > 0) { + if(XGetWindowProperty (dpy, Sown, XA_CUT_BUFFER0, 0, bytes, 0, AnyPropertyType, &type, &format, &len, &dummy, &data) == Success) { + txt_insert_buf(text, data); + } + } + } + } + if(data) {XFree(data);} + XCloseDisplay(dpy); +#endif } void txt_copy_clipboard(Text *text) {