[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to reconnect to a new X Server
From: |
Dr. H. Nikolaus Schaller |
Subject: |
Re: How to reconnect to a new X Server |
Date: |
Wed, 22 May 2013 11:55:59 +0200 |
Am 22.05.2013 um 11:34 schrieb Sebastian Reitenbach:
> Hi,
>
> working with Riccardo on GAPs loginpanel, made some progress, but ran into
> trouble now.
>
> What I do is starting the X Server, before I then start the loginpanel
> application.
> Then the loginpanel actually has an X server running, where it can connect to.
>
> So far, that works well. I can login. When I logout, then I am killing the X
> server, and
> want to restart it, and spawn the loginpanel again.
>
> First I tried in loginpanels main function:
>
> while (1)
> {
> [XManager startXServer];
> putenv("DISPLAY=:0.0");
>
> NSApplicationMain(argc, argv);
>
> }
>
>
> That probably was too naive from me thinking it might work ;) Reading up
> NSApplication
> documentation, I see that everything after NSApplicationMain(argc, argv);
> will not be
> exectuted, so the while loop will only runs once :(
>
> Anyways, then I tried to start the XServer again, after I teared it down.
> That works so far, but when the loginpanel wants to reset its window on the X
> server,
> I see it crying on the console, that the connection to the XServer broke:
>
> X connection to :0.0 broken (explicit kill or server shutdown)
>
> Even if there is a new server spawned already on the same display.
>
> Is there a way to tell the application that the X Server disappeared, and it
> should reconnect to the new one? Or tell it to kind of respawn itself?
I think what you are looking for should be done in the startx or xinit scripts
of
your system. They are usually responsible for restarting X servers. Also
initd and its run-levels play some role.
So the loginpanel should also be restarted by the same mechanism.
I.e. you could try to make it sort of a display and/or window manager.
Nikolaus