Prev: A break in loop follwed by close pipe gives error "Operation Failed"
Next: Easy Way To Get Google Adsense Account Approval.
From: jjmcwill on 13 Apr 2010 10:01 I work on a native C++ app that uses Tcl/Tk as the gui. How can I put a image/png or image/bmp on the clipboard for Linux? I've done this successfully using a simple standalone C++ app that makes calls directly to Xlib and does not use Tck/Tk. I understand that I need to use Tk_CreateSelHandler() to do this with Tk, because the X Selection events (such as SelectionRequest) don't get passed to the proc I add to Tk_CreateGenericHandler() I looked at the code in tkUnixSelect.c It appears that the code in there wants to set the format parameter of XChangeProperty() to 32 unless the type is some sort of string. It also uses string NULL searching functions like strlen(). This isn't going to work for sending a buffer containing a PNG or a Bitmap! In my sample app, I call XChangeProperty with format set to 8, and type set to an Atom for "image/png" or "image/bmp". The INCR support in tkUnixSelect.c also appears to make the same assumptions about the use of null-terminated strings in the buffer.
From: Donal K. Fellows on 13 Apr 2010 11:02
On 13 Apr, 15:01, jjmcwill <jeff.mcwilli...(a)gmail.com> wrote: > How can I put a image/png or image/bmp on the clipboard for Linux? Right now, there's a problem there. We don't handle putting up sequences of bytes correctly, unlike sequences of 32-bit words. (I think we now retrieve them correctly; I remember fixing that...) Donal. |