wayland: Add conditional Xwayland EI portal support

With EI support wired to XTEST, and oeffis being enabled in Xwayland
means that XTEST will always go through the XDG portal.

While this the intended behavior for the general use case of Xwayland
running rootless on a desktop compositor, that breaks when Xwayland is
running on a nested compositor, because the portal is for the entire
session and not limited to the nested Wayland compositor.

Enable XDG portal support in Xwayland only when we managed to connect
to the GNOME session manager, which means we are running in a full
desktop session, and not in any form of nested mode.

This is determined by simply using the status returned by set_gnome_env()
which will fail if not connected to a GNOME Session manager.

See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1586
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1170
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3047
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3303>
This commit is contained in:
Olivier Fourdan 2023-09-29 16:39:06 +02:00 committed by Marge Bot
parent 8abbbc7ea9
commit dda13526c3

View File

@ -871,9 +871,16 @@ meta_wayland_compositor_new (MetaContext *context)
#ifdef HAVE_XWAYLAND
if (x11_display_policy != META_X11_DISPLAY_POLICY_DISABLED)
{
gboolean status = TRUE;
status &=
set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name);
status &=
set_gnome_env ("DISPLAY", compositor->xwayland_manager.public_connection.name);
status &=
set_gnome_env ("XAUTHORITY", compositor->xwayland_manager.auth_file);
meta_xwayland_set_should_enable_ei_portal (&compositor->xwayland_manager, status);
}
#endif