Serious flaw in Cygwin X clipboard integration prevents paste from X to Windows apps

Stahlman Family
Mon Jan 23 12:54:00 GMT 2006

> Hi,
> Stahlman Brett wrote:
> > I will try to look into
> > it as I get time over the next few days...
> I can quickly build an experimental Xming.exe with any patch you have in
> mind.
> (Xming shares the same code base as Cygwin/X).
> If proven the patch could then be incorporated into Cygwin/X, at leisure,
> via an XOrg bugzilla.

 I have managed to build XWin.exe with a first-cut of my proposed
solution. It appears to work. At least, a paste in a Windows app gets
the latest selection from the unpatched version of gvim. There is
something I need to look into however. This may just be the way gvim
works, but I've noticed that the PRIMARY selection always takes
precedence over CLIPBOARD, even when there's no longer anything visually
selected in gvim and there's been a yank to the '+' register since text
was deselected. My feeling is that this must be just the way vim works,
since I know that X is calling Vim's callback for each subsequent paste
into a Windows app, but I need to dig through Vim's source code a bit to
understand why it happens this way.

In case I didn't make the situation clear, basically, it's like this:
after opening gvim, you can make selections into the '+' register and
paste into a Windows app, and everything works fine, even for multiple
copies and pastes. However, once you've either selected something into
the '*' register (PRIMARY), or selected text with the mouse in gvim,
subsequent pastes into a Windows app will always reflect what's in the
'*' register, even if you go back to gvim and deselect text and yank
into the '+' register. It continues like this until another app has
owned the selection. Note that vim does copy text yanked to '+' into
'*', so perhaps text is always being pasted from PRIMARY. As I said, I
need some time to go through the Vim source here and figure out exactly
what's happening.  I'll keep you posted...

 Brett S.
> Colin Harrison

Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list