Re: Pushing text onto the selection buffer
- From: Havoc Pennington <hp redhat com>
- To: spirilis scitus yi org
- Cc: gtk-list gnome org
- Subject: Re: Pushing text onto the selection buffer
- Date: 22 Jul 2000 20:56:00 -0400
spirilis@scitus.yi.org writes:
> Is it possible with GTK/GDK calls to push text onto the selection buffer
> so someone may paste it?
>
Certainly. The source for GtkEditable is a decent example of how to do
this from a widget (see gtkeditable.c). Without a widget, things
are pretty similar.
This should be helpful:
http://developer.gnome.org/doc/API/gtk/gtk-selections.html
Also, look at the ICCCM, which is a manual that comes with the X
Window System. Look in /usr/doc or /usr/share/doc on many Linux
distributions, or poke around on www.x.org/www.xfree86.org.
The X window system selection API is asynchronous. It works like this:
- you ask for the selection which means you say "I want to own the
selection". Note that you have to specify which selection
you mean; the normal two are PRIMARY (which is the one
you use if the user highlights text but doesn't explicitly
cut/copy) and CLIPBOARD (use this for explicit cut/copy/paste).
- If you get the selection, other apps can now ask you for the
selected data. When they do you get a signal (selection_get) and
you must put your selection data in the GtkSelectionData passed to
your callback using gtk_selection_data_set().
- There's a selection_clear signal which you get when someone
else grabs the selection (that is, the user did a copy/cut in
another app or widget); at that point you can delete your
selected text since no one will be asking for it.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]