This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xwinclip not waiting for x server startup (was xwinclip authorisation)


> Hi Shane,
>
> Cygwin/Xfree and XDMCP work correctly.  I only get a problem when running
a
> local X client at the same time as a remote X client (via XDMCP).  It
turns
> out a /etc/X0.hosts file containing a 'localhost' entry is needed.  Also
> xwinclip does not wait for the X server to complete startup, while some
> other clients (such as xterm) do.
>
> Any ideas why xwinclip does wait for X server startup?
>
> cheers Matthew

I wrote xwinclip.  The reason that it behaves differently than 'xterm' is
that xterm uses the XToolkit library, which xwinclip cannot use.  xwinclip
cannot use XT because we need to have a specialized event loop that
processes both X events and Win32 messages.  xwinclip needs the extra
options provided by using the X11 api directly, rather than through a
toolkit.

Now, you ask "why xwinclip [doesn't] wait for X server startup?"  I can
answer that question simply: because not enough is known about how we need
to "wait".  In other words, the issue is not well enough defined for it to
be solved.

I just added a loop that retries opening the X display several times.  That
change didn't really do anything.

Part of the problem is that the X Server (in a part of the code that we did
not write) accepts the xwinclip connection before  xdmcp connects to the
remote host.  xdmcp causes the server to reset when it gets a connection to
the remote host, so xwinclip is shutdown after xdmcp connects.

Now, two ideas come to mind to solve that problem, neither of which will
work:
1) Don't exit when we receive a message that the server is going to reset.
Instead, try to reconnect for about ten seconds.

   The problem here is that the error is generated by a libX11 function,
which calls _XDefaultIOError to report the error.  The problem with
_XDefaultIOError is that it then calls exit(1), so xwinclip never has a
chance to handle the error on its own.

2) Delay connecting to the X server by a number of seconds, regardless of
whether xdmcp is being used or not (as we have no way of knowing).  Perhaps
even allow a parameter to specify how many seconds to delay.

   This solution only duplicates the functionality of the 'sleep x' command,
where x is the timeout in seconds.  There is no point in duplicating
functionality.


The only way that I know of to get xwinclip to work with XDMCP is to change
your batch file (startxwin.bat) to something like the following:

start /B XWin -noreset -ac -query huntharo-4.user.msu.edu
sleep 8
start /B xwinclip

That's it for now,

Harold


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]