Skip to content
  • Olivier Fourdan's avatar
    xfixes: Add ClientDisconnectMode · e167299f
    Olivier Fourdan authored
    
    
    With Wayland compositors now being able to start Xwayland on demand, the
    next logical step is to be able to stop Xwayland when there is no more
    need for it.
    
    The Xserver itself is capable of terminating itself once all X11 clients
    are gone, yet in a typical full session, there are a number of X11
    clients running continuously (e.g. the Xsettings daemon, IBus, etc.).
    
    Those always-running clients will prevent the Xserver from terminating,
    because the actual number of X11 clients will never drop to 0. Worse,
    the X11 window manager of a Wayland compositor also counts as an X11
    client, hence also preventing Xwayland from stopping.
    
    Some compositors such as mutter use the XRes extension to query the X11
    clients connected, match their PID with the actual executable name and
    compare those with a list of executables that can be ignored when
    deciding to kill the Xserver.
    
    But that's not just clumsy, it is also racy, because a new X11 client
    might initiate a connection the X11 server right when the compositor is
    about to kill it.
    
    To solve this issue directly at the Xserver level, this add new entries
    to the XFixes extension to let the X11 clients themselves specify the
    disconnect mode they expect.
    
    Typically, those X11 daemon clients would specify the disconnect mode
    XFixesClientDisconnectFlagTerminate to let the Xserver know that they
    should not be accounted for when checking the remaining clients prior
    to terminate.
    
    Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
    Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
    e167299f