Internal client connections to the X Server (for integrating the Windows and X clipboards)

Harold L Hunt II
Sat Jan 25 02:10:00 GMT 2003

I have been working on a small X Client called xwinclip for the
Cygwin/XFree86 project ( for over a year now.  The
aim of this program is to provide integration between the Windows clipboard
and the X clipboard, but so far the results have been less than stellar.
There are several commercial X Servers for MS Windows that have several
desirable features that we have been unable to reproduce:

1) Not having to reown the XA_PRIMARY atom when the selection changes in X.
We copy the X selection to the Windows clipboard whenever it is changed, but
the only way to receive future change notification seems to be to retake
ownership of the XA_PRIMARY atom.  This causes the selected text, in say
xterm, to become unselected.  Many programs have features that allow you to
manipulate selected text, so this is obviously a problem.  None of the
commercial X Servers have this problem.  We have tried an alternative of
only stealing ownership of XA_PRIMARY when our X Server loses the focus in
Windows... but non of the commercial X Servers even does that; they NEVER
steal ownership of XA_PRIMARY.

2) Since we are running an X Client to perform the clipboard integration we
have problems with security on XDMCP sessions.  The problem is that the
local xwinclip client cannot connect to the local X Server unless you run
xhost within you XDMCP session and specifically allow connections from the
localhost.  None of the commercial X Servers for Windows requires any
special handling of the clipboard support for XDMCP sessions.

These two problems have been largely unsolvable for me.

Recently (i.e. this week) I integrated the functionality of xwinclip into
the X Server executable, with the "clipboard manager" running in a separate
thread than the X Server.  Now that I have done this, I started thinking
that there has to be an easier, perhaps "internal", way to both monitor the
updating of the selection and to prevent our clipboard manager's connection
from being rejected.  I remembered seeing somewhere in the X Server source
code references to a "fake connection number" or something of that sort.  I
was wondering if there is a mechanism whereby the X Server can call
functions in the X Client interface without actually having to authenticate
with itself.  If that was possible, it would seem that at least our
authentication problem would be taken care of.  So, does anyone know if that
exists or have I been missing too much sleep lately?  :)

Any hints, tips, suggestions, or anything else related to the above two
issues would be greatly appreciated.

Thanks in advance,

Harold Hunt
Cygwin/XFree86 Project Leader

More information about the Cygwin-xfree mailing list