Re: Pushing text onto the selection buffer
- From: Guy Harris <gharris flashcom net>
- To: spirilis scitus yi org
- Cc: gtk-list gnome org
- Subject: Re: Pushing text onto the selection buffer
- Date: Sat, 22 Jul 2000 17:51:09 -0700
On Sat, Jul 22, 2000 at 07:51:31PM -0400, spirilis@scitus.yi.org wrote:
> Is it possible with GTK/GDK calls to push text onto the selection buffer
> so someone may paste it?
I assume you're referring to what, in X, are the primary, secondary, and
clipboard selections, where
the primary selection is what the middle mouse button pastes;
the secondary selection is, I think, a Xeroxism used by Sun in
OPEN LOOK, and perhaps used elsewhere;
the clipboard selection is what's pasted by Ctrl+V,
"Edit->Paste", and so on.
(<RANT>Note that, the belief of some UNIX users to the contrary, there's
more to cut-and-paste on UNIX/X systems than "select something and then
paste it with the middle mouse button" - there's also the same sort of
clipboard-based cut-and-paste that appears in other window systems.
GTK+, bless its heart, supports that for text widgets, and Motif also
supports it; Qt, for some unknown reason, seems to think the universe
rotates around the PRIMARY selection, causing cut-and-paste between Qt
applications such as KDE applications, and Motif or GTK+ applications,
not always to work as one might like.
Try, for example, typing text into "kedit", copying it with
"Edit->Copy", and then try to paste it into Netscape's "Open Page"
dialog box with Alt+V - then try typing text into some GTK+ application,
copying it with Ctrl+C, and then try to paste *that* into "Open Page"
with Alt+V. The first didn't work for me, at least, but the second
did.</RANT>)
If so, then you'd manipulate those selections with the "gtk_selection"
calls; see section 19, "Managing Selections", in the GTK+ tutorial, and
the section on "Selections" in the GTK+ reference documentation. (I've
not written code to do any of this, so asking me detailed questions is
unlikely to get useful answers.)
The clipboard selection doesn't have a standard X11 atom, so you have to
do a little more work; see the stuff in the GTK+ source in
"gtk/gtkeditable.c to get the clipboard atom value "clipboard_atom" (and
perhaps as sample code for manipulating selections).
It might not be a bad idea if GTK+ or GDK were to export
"clipboard_atom" and do the
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
stuff itself, so that widgets that are not not subclasses of GtkEditable
don't have to get the clipboard atom themselves.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]