Xwayland on demand (Re: [PATCH xwayland 3/3] xwayland: Handle the case of windows being realized before redirection)

Pekka Paalanen ppaalanen at gmail.com
Mon Jan 21 08:34:13 UTC 2019


On Sun, 20 Jan 2019 09:29:50 -0800
"Jasper St. Pierre" <jstpierre at mecheye.net> wrote:

> Hi,
> 
> Catching up on this thread. It's possible I missed something here, but
> here's my two cents.
> 
> Right now, the Wayland compositor sets up a "dummy" socket for the X11
> display. When a client connects, it launches Xwayland on-demand. I assume
> this socket handoff is done similar to the systemd approach, where FDs are
> inherited into execution context and their names passed by some convention
> like LISTEN_FDS.

Hi Jasper,

that is correct. IIRC the fds get named via command line arguments.

> Until Xwayland adds the socket to its own loop, the client is paused
> anyway. So there are no race conditions here -- the race condition only
> happens once Xwayland adds the socket. What if we had a special Wayland
> event like "add_listen_fd", using Wayland's FD passing, which would add a
> new FD to the listen loop of Xorg. With this, we can create a three-stage
> initialization process: 1. Create a special "setup" FD, pass it to
> add_listen_fd. 2. Run gnome-settings-daemon, xrdb, on this "setup" FD. 3.
> After initialization settles, we then pass the client-activated socket
> through "add_listen_fd", and the client will finish the handshake process.

That is very much the idea I presented, but I didn't specify how to
pass fds to Xwayland after its start-up.

> The implementation difficulty here is passing the special setup FD to
> clients -- we would have to modify Xlib to allow connecting to an X11
> socket by FD (using something like xcb_connect_to_fd), and we would have to
> ensure that this all inherits to children correctly if
> gnome-settings-daemon needs to launch clients during setup (I think glib
> forces O_CLOEXEC before spawning children now -- oops). But FD passing for
> initialization is already "the right way" to do things in a systemd world,
> so it's probably something investing in.
> 
> A quick and dirty prototype of this that wouldn't require FD passing could
> simply use DISPLAY=:99 as the "setup display".
> 
> Thoughts?

I think the DISPLAY=:99 approach would be sufficient if someone wants
to implement this. The setup socket has no special meaning after the
start-up sequence, so it could be used for normal apps as well, which
means that if someone e.g. starts a panel app from the setup script, it
won't hurt if that app then launches more X11 apps with the setup
socket.

If a Wayland compositor launches an arbitrary script to initialize
Xwayland server state, the compositor could take the exit of that
process to signify the setup from the script is complete. The
compositor could even launch the script only after its own XWM is ready.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg-devel/attachments/20190121/6752db9d/attachment.sig>


More information about the xorg-devel mailing list