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

Re: Where are my copy buffers?



-----BEGIN PGP SIGNED MESSAGE-----

On Wed, 8 Sep 1999, David Blackman wrote:

> I'm want to start writing perl & c programs that actually do stuff. What
> I'm wondering is this: 
> 
> When I'm in X windows, and I highlight something, where does it go (I
> know to the clipboard), but is that an actual file I can access?

No, it's not an actual file. X actually has several types of selections.
Oddly enough, even though one is named CLIPBOARD, the standard clipboard
functionality is involved with selection PRIMARY.

When an application wants to own the selection, it calls
XSetSelectionOwner with the proper arguments.

Later on, when an application wants to get the value of that selection, it
calls XConvertSelection. This sends the selection owner a SelectionRequest
event.

The first application recieves the SelectionRequest event, telling it who
wants the selection and what format it wants. It therefore sets a property
on the second's window and sends the second a SelectionNotify event. If it
can't comply for some reason, it sends a SelectionNotify event with the
property set to None.

The requestng application recieves the SelectionNotify event, and if the
property isn't None it can then retrieve the data with XGetWindowProperty.

Eventually, someone else will try to own the selection, and the current
owner will recieve a SelectionClear event.

Read the xbook on X11/Xlib for more info. Also, note that the various
toolkits may provide wrappers for all this. For an example, look at the
manpage Tk::selection(3pm), from the perl-tk package.

> When I'm on the console and I highlight something, where does it go?
> Is it a file I can access?

This one i don't know...


- -- 
  finger for PGP public key.


-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBN9cPVb7M/9WKZLW5AQFUDAP9Fb7jEigbbM1XMeyolLYuZphxJnuq1L4v
7W0mkhgIM02XReDWSiDapmfVrcKuwOFJZA/LeAJwY6xxmCidPY8qAP4jjQP/vQZs
1kxZzhdV1lDtUTlsWCUqQxG+xjSUzKuVPgLqUApuflPuBlMe+KGtV21w116hK4ht
8uLJU9ry3Gg=
=JKm4
-----END PGP SIGNATURE-----


Reply to: