From fe9017c15ae111dad8271a150303c63dc8217655 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 29 Sep 2023 11:37:20 +0200
Subject: [PATCH] xwayland: Enable optional XDG EI portal support

Xwayland has now a new command line option "-enable-ei-portal" [1] for
the Wayland compositor (who spawn Xwayland) to explicitly enable support
for XDG EI portal in Xwayland.

Add that command line option when spawning Xwayland according to what
was requested from the MetaXWaylandManager .

[1] https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1170

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3303>
---
 src/wayland/meta-xwayland.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 47591924c..8677d5ebb 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -909,6 +909,13 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
     {
       g_warning ("autoclose-xwayland disabled, not supported");
     }
+#endif
+#ifdef HAVE_XWAYLAND_ENABLE_EI_PORTAL
+    if (manager->should_enable_ei_portal)
+      {
+        /* Enable portal support */
+        args[i++] = "-enable-ei-portal";
+      }
 #endif
   for (j = 0; j <  G_N_ELEMENTS (x11_extension_names); j++)
     {