Hi, I am trying to use the gtk clipboard. I want to be able to set the data on the clipboard twice in a row. I have run into some unexpected behavior, however. Here is an example program: #include <gtk/gtk.h> #include <stdio.h> #include <string.h> void GetNoOp(GtkClipboard* clipboard, GtkSelectionData* selection_data, guint info, gpointer user_data) { } void ClearNoOp(GtkClipboard* clipboard, gpointer user_data) { } void PrintTargets() { GdkAtom* targets; int num_targets = 0; GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_wait_for_targets(clip, &targets, &num_targets); printf("\nAvailable targets:\n---------------\n"); for(size_t i = 0; i < num_targets; i++){ printf(" [%s]", gdk_atom_name(targets[i])); } printf("\n"); } int main(int argc, char* argv[]){ char* data = new char[2]; gtk_init(&argc, &argv); GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); GtkTargetEntry targets1[] = {{"TEXT", 0, 0}}; GtkTargetEntry targets2[] = {{"TEXT", 0, 0}, {"IMAGE", 0, 0}}; gtk_clipboard_set_with_data(clipboard, targets1, 1, GetNoOp, ClearNoOp, data); PrintTargets(); // the output is the same if you uncomment the following // gtk_clipboard_clear(clipboard); gtk_clipboard_set_with_data(clipboard, targets2, 2, GetNoOp, ClearNoOp, data); PrintTargets(); } The output is Available targets: --------------- [TIMESTAMP] [TARGETS] [MULTIPLE] [TEXT] Available targets: --------------- [TIMESTAMP] [TARGETS] [MULTIPLE] [TEXT] whereas I would have hoped it would be something like Available targets: --------------- [TIMESTAMP] [TARGETS] [MULTIPLE] [TEXT] Available targets: --------------- [TIMESTAMP] [TARGETS] [MULTIPLE] [TEXT] [IMAGE] Does anyone have any insight why this might be happening? Note that in my actual program I do set data and I still have this hiccup. And if you reverse the order of the set_with_data calls, then you get the following as output: Available targets: --------------- [TIMESTAMP] [TARGETS] [MULTIPLE] [TEXT] [IMAGE] Available targets: --------------- [TIMESTAMP] [TARGETS] [MULTIPLE] [TEXT] [IMAGE] Thanks. --------------- Evan Stade _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list