When the Xwayland server is socket-activated, we need to connect and initialize the window manager before the activating client gets to proceed with connecting. We do this by passing a socket file descriptor for the window manager connection to the Xwayland server, which then uses this new function to set it up as an X client.
Signed-off-by: Kristian Høgsberg <[email protected]> --- include/os.h | 2 ++ os/connection.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/os.h b/include/os.h index 90229e6..5be3bcc 100644 --- a/include/os.h +++ b/include/os.h @@ -168,6 +168,8 @@ extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); +extern _X_EXPORT void AddClientOnOpenFD(int /* fd */ ); + extern _X_EXPORT CARD32 GetTimeInMillis(void); extern _X_EXPORT CARD64 GetTimeInMicros(void); diff --git a/os/connection.c b/os/connection.c index b50f9e9..f1e7a25 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1312,3 +1312,23 @@ ListenOnOpenFD(int fd, int noxauth) XdmcpReset(); #endif } + +/* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */ +void +AddClientOnOpenFD(int fd) +{ + XtransConnInfo ciptr; + CARD32 connect_time; + + ciptr = _XSERVTransReopenCOTSServer(5, fd, "@anonymous"); + + _XSERVTransSetOption(ciptr, TRANS_NONBLOCKING, 1); + ciptr->flags |= TRANS_NOXAUTH; + + connect_time = GetTimeInMillis(); + + if (!AllocNewConnection(ciptr, fd, connect_time)) { + ErrorF(stderr, "failed to create client for wayland server\n"); + return; + } +} -- 1.9.0 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
