Subj : Clipboard/Primary Select To : Digital Man From : Deuce Date : Tue Jan 25 2005 02:44 am Re: Clipboard/Primary Select By: Digital Man to Deuce on Mon Jan 24 2005 14:38:00 > Guess I need a lesson. What's this "PRIMARY" stuff? Well... *clears throat* First off, X has a concept of what are called Selections... only one process can own a selection at any given time, and any process can take ownership at any time. Any process can get the current owner of a selection and can ask any process for their copy of a specific selection in a specified format. There are two pre-defined selections in X that I can find... PRIMARY and SECONDARY. Traditionally, SECONDARY is never used. How Drag-select/middle button copy/paste is traditionally implemented is as follows: 1) User drag-selects something. 2) Process takes ownership of PRIMARY 3) User middle-clicks in something 4) Something asks the X server "Who owns Primary?" 5) X server says "Window ZZZ does" 6) Something asks X server "Tell Window ZZZ to send me a copu in YYY format" 7) X server does that 8) Window ZZZ converts to format YYY is possible and sends it along to the X server wheather it's been converted or not. 9) X server sends it to the requesting client. Now, every GUI standard thing I've ever seen says that this is the One True Primary copy/paste method... but it says that *explicit* copy/paste should work differently... essentially, when you select COPY in the app, it copies the selection to a buffer somewhere and asserts ownership of CLIPBOARD... so CLIPBOARD is the last thing that was explicitly copied, and PRIMARY is the thing that's currently highlighted. You can watch the ownership of PRIMARY by opening two xterm windows... drag-select something in one window... it's now the PRIMARY Selection. Drag-select something in the other window, *IT* is now the PRIMARY, and the first one looses ownership (and de-highlights the text) Now, everyone does this... it's part of the freedesktop "standard" (http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt) What I want to know is WHY THE HELL DON'T THEY SPECIFY TO USE SECONDARY instead of the non-standard CLIPBOARD?!?! --- þ Synchronet þ ``Penguins make tasty snacks'' .