Copying a PIXMAP into the clipboard



I wish to copy a pixmap into the GTK+ clipboard.
 
When the Copy operation happens in my app., I set the appropriate targets that I'm advertising by using gtk_clipboard_set_with_data, eg.:
 
gtk_clipboard_set_with_data(gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), image_targets, G_N_ELEMENTS(image_targets), get_clipboard_data, clear_clipboard_data, (gpointer)SECONDARY_CLIPBOARD);
 
On doing a Paste in an application like kpaint, my callback function, "get_clipboard_data" gets called with the correct value requesting the PIXMAP target.
 
I paste the PIXMAP into the clipboard such... 

Pixmap *pixmapPtr = (Pixmap *)ASmalloc(sizeof(Pixmap));
*pixmapPtr = my_clipboard_data->pixmap;
gtk_selection_data_set(selection_data, GDK_SELECTION_TYPE_PIXMAP, 32, reinterpret_cast<guchar*>(pixmapPtr), 1);
 
However, the receiving application isn't able to receive the PIXMAP pasted.
 
Just before doing the gtk_selection_data_set, I've verified that the pixmap is correct by saving it out to an xpm file on disk and then viewing it in an image viewer.
 
Any ideas on what might be incorrect here? I'm using a pretty old version of GTK+ 2.0.9, however I didn't see any major changes in the way targets are handled in subsequent versions.
 
-vc


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]