public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Harold L Hunt II <huntharo@msu.edu>
To: cygwin-xfree@cygwin.com
Subject: Re: X11 Selections
Date: Sat, 03 Jan 2004 23:28:00 -0000	[thread overview]
Message-ID: <3FF74FFF.4000008@msu.edu> (raw)
In-Reply-To: <Pine.LNX.4.55.0401032358520.18354@lupus.ago.vpn>

Alexander Gottwald wrote:
> Just what I've already written in IRC:
> 
> I've looked into the ICCCM to find out about the handling of X11 selections.
> From what I've read the xclient (eg xterm) just calls XSetSelectionOwner and
> can do whatever he wants. The actual data is accessed only when another
> client calls XConvertSelection. Is this correct?

Yes, I believe that is correct.

> But I have no idea what happens if the xterm calls XSetSelectionOwner, the
> other app gets the data with XConvertSelection and the xterm then modifies
> the selection without calling XSetSelectionOwner again  because it already
> own the selection buffer.

I think you are always supposed to (or at least it is common in 
practice) to call XSetSelectionOwner whenever the clipboard contents 
change, even if you already own the selection.

> To refine the outline the idea:
> 
> X11->Win32
> 
>  X11 client calls XSetSelectionOwner
> 
>   - get the data from the client (maybe by using a fake window or the root
>     window as recipient of the clipboard data)
>   - translate the data for the windows clipboard
>   - OpenClipboard
>   - EmptyClipboard
>   - SetClipboardData
>   - CloseClipboard

Actually, we can break this into two pieces like the Win32->X11 part 
below by calling SetClipboardData (foo, NULL)... this tells Windows that 
we are delaying rendering the copied text/image/whatever and we must 
process WM_RENDERFORMAT and WM_RENDERALLFORMATS to do the actual copying 
if the data is ever pasted within Windows.

This is great because it prevents copying text over the wire that will 
never be pasted, and it sets us up to handle images and other things 
that we do not currently handle.

>  If every change of the selection is indicated by XSetSelectionOwner then
>  we always place the copy of the selection in the clipboard.

I think we always get an XSetSelectionOwner call, but lets try to delay 
the actual copying until later, as I mentioned above.

> Win32->X11
> 
>  Win32 client copies to the clipboard
> 
>   - WindowProc receives WM_DRAWCLIPBOARD
>   - call ProcSetSelectionOwner with RootWindow (or fake window) as owner

Yes, that is good.

>  X11 client calls XConvertSelection
> 
>   - receive SelectionRequest event
>   - translate clipboard data for xclient
>   - send data to client

Right.  This is exacly like I mentioned above for delaying the copying 
in the X11->Win32 path.

Sounds like we have a good plan for implementing the next version of 
clipboard integration.

Harold


  reply	other threads:[~2004-01-03 23:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-03 23:16 Alexander Gottwald
2004-01-03 23:28 ` Harold L Hunt II [this message]
2004-01-03 23:34   ` Alexander Gottwald
2004-01-04  0:22     ` Harold L Hunt II
2004-01-04  7:47       ` Harold L Hunt II
2004-01-04  9:35         ` Kensuke Matsuzaki
2004-01-04 21:13           ` Harold L Hunt II
2004-01-04 14:07         ` Alexander Gottwald
2004-01-04 14:48           ` Kensuke Matsuzaki
2004-01-04 21:11             ` Harold L Hunt II
2004-01-04 22:14               ` Harold L Hunt II

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FF74FFF.4000008@msu.edu \
    --to=huntharo@msu.edu \
    --cc=cygwin-xfree@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).