Hi there,

I hope that this is not a FAQ, I am pretty new on this

I am trying to get the copied selection in thegimp
(Select a region of an image loaded in thegimp and
then press ctl+c) in my gtk application. I already
know how to get for example the selection if this
is TEXT in another X or Gtk application .. 

void on_button_GetClip_clicked
(GtkButton       *button,
 gpointer         user_data)
  static GdkAtom targets_atom = GDK_NONE;
  if (targets_atom == GDK_NONE)
  targets_atom = gdk_atom_intern ("TEXT", FALSE);
  gtk_selection_convert (button, GDK_SELECTION_PRIMARY, 
                                  targets_atom, GDK_CURRENT_TIME);

void on_button_GetClip_selection_received
(GtkWidget       *widget,
 GtkSelectionData *data,
 guint            time,
 gpointer         user_data)
  if (data->length > 0)
   GtkText *text;
   text = lookup_widget(GTK_WIDGET(widget),"text_in");

Is this similar for getting the data which thegimp will
'broadcast' to the other X applications ?
my best guess is that I have to use another atom here :
targets_atom = gdk_atom_intern ("TEXT", FALSE);

My next question will be .. how do I 'set' this clipboard
of thegimp from my external gtk application.. or perhaps
I will have to write a gimp plugin for something like that?
Again, I already know how to do this for TEXT clipboards .. 
(there was a very good example available for this at the 
Gtk+ documentation :

Philip van Hoof aka freax (http://www.freax.eu.org)
irc: irc.openprojects.net mailto:freax @ pandora.be

Gimp-developer mailing list

Reply via email to