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 re selection polling


Harold L Hunt II said:
> I have searched for months and months for a way to receive a
> definite  signal that the X server is about to shutdown.  There is a
> hook provided  by most window managers to indicate that the display
> is closeing, but it  has so far given mixed results.  The last idea
> I saw was in the x2x (I  think) source code, which interfaces with
> the raw Xlib, just like  xwinclip.  It looked like x2x was watching
> for a move message for the  mouse to (0, 0) (or some other special
> point) and it took this as a  signal to close the X client
> connection.

Please correct me if I'm wrong, but isn't it the case that you merely
need to be able to gracefully handle the "X server is dead" case
rather than knowing the X server is about to exit?

If so, perhaps this (grotty kludge) is what you want.  During
initialization, after the initial connection to the X server is made
(using the appropriate X library funtions), MANUALLY create another
connection to the X server (e.g. open a socket and send some
messages).  Then, before any X operations, try accessing the manual
socket to make sure X is still up (e.g. ping the server).  If the ping
fails, then you can un-hook your event gracefully.  Yes, there's still
a window where you ping, the server goes down, and then you try your
operation, but I doubt you really want to do it all by hand.  The ping
will be painful enough.

This idea has come to me through the python-xlib project, which
basically implements libX11 in pure python code (except for the socket
layer, of course).  My understanding is that the fundamental problem
is that the X11 functions generally force an application exit when
they fail to do server absence.



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