From dda13526c30c74411dcba95484550066c691d82f Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 29 Sep 2023 16:39:06 +0200 Subject: [PATCH] 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: --- src/wayland/meta-wayland.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index d2544565c..a2bd7d2ab 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -871,9 +871,16 @@ meta_wayland_compositor_new (MetaContext *context) #ifdef HAVE_XWAYLAND if (x11_display_policy != META_X11_DISPLAY_POLICY_DISABLED) { - set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name); - set_gnome_env ("DISPLAY", compositor->xwayland_manager.public_connection.name); - set_gnome_env ("XAUTHORITY", compositor->xwayland_manager.auth_file); + 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