Is x server connection still valid?

hugo vanwoerkom huugske at gmail.com
Tue Jan 9 15:17:00 PST 2007


On 1/9/07, Daniel Stone <daniel at fooishbar.org> wrote:
> On Tue, Jan 09, 2007 at 04:26:56PM -0600, hugo vanwoerkom wrote:
> > On 1/9/07, Daniel Stone <daniel at fooishbar.org> wrote:
> > >On Tue, Jan 09, 2007 at 04:05:17PM -0600, hugo vanwoerkom wrote:
> > >> I hope this is the right place to ask this question:
> > >>
> > >> I have various displays and want to modify the LEDs of the keyboards
> > >> connected to them.
> > >>
> > >> In order to do that I XOpenDisplay and see if it is successful.
> > >>
> > >> If successful I use XChangeKeyboardControl.
> > >>
> > >> But how do I find out next time I use that function that the X server
> > >> connection is still valid?
> > >> The user may have logged off, causing a SIGPIPE fault in using the
> > >function.
> > >> Is there some way to find if the display structure actually still is
> > >> for an existing connection without getting into that SIGPIPE?
> > >
> > >Xlib's default behaviour is to just terminate your process (see
> > >XSetIOErrorHandler, I think it is), so you're pretty safe there.
> >
> > Daniel, I don't want to terminate the process. This is for a started
> > task that writes to all keyboard LEDs. You mean there is no way to
> > find out if the display structure that I use in
> > XChangeKeyboardControl is still safe to use?
>
> There's no way to have the process not terminate when you use Xlib.
> It's a shocking API.
>

Fun nonetheless ;-)
Found this:
http://www.faqs.org/faqs/Xt-FAQ/section-19.html
which I will follow. Thanks Daniel.

Hugo



More information about the xorg mailing list