1
0
Fork 0

xwayland: Check for listenfd option

Current Xwayland has marked the command line option "-listen" as
deprecated in favor of "-listenfd".

Use the pkg-config variable "have_listenfd" (if available) from Xwayland
to determine if we should use that option, to avoid a deprecation
warning when spawning Xwayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1682>
This commit is contained in:
Olivier Fourdan 2021-01-22 11:16:24 +01:00
parent 26cc51a1a5
commit 22b926eea7
3 changed files with 23 additions and 3 deletions

View file

@ -71,6 +71,9 @@
/* Whether Xwayland has -initfd option */
#mesondefine HAVE_XWAYLAND_INITFD
/* Whether Xwayland has -listenfd option */
#mesondefine HAVE_XWAYLAND_LISTENFD
/* Whether libX11 has XSetIOErrorExitHandler */
#mesondefine HAVE_XSETIOERROREXITHANDLER

View file

@ -391,6 +391,7 @@ if cc.has_header_symbol('sys/prctl.h', 'prctl')
endif
have_xwayland_initfd = false
have_xwayland_listenfd = false
if have_wayland
xwayland_dep = dependency('xwayland', required: false)
@ -434,6 +435,15 @@ if have_wayland
if (have_xwayland_initfd)
cdata.set('HAVE_XWAYLAND_INITFD', 1)
endif
# For Xwayland -listenfd usage
if xwayland_dep.found()
have_xwayland_listenfd = xwayland_dep.get_pkgconfig_variable('have_listenfd') == 'true'
endif
if (have_xwayland_listenfd)
cdata.set('HAVE_XWAYLAND_LISTENFD', 1)
endif
endif
have_xsetioerrorexithandler = false
@ -518,6 +528,7 @@ output = [
' Introspection............ ' + have_introspection.to_string(),
' Profiler................. ' + have_profiler.to_string(),
' Xwayland initfd.......... ' + have_xwayland_initfd.to_string(),
' Xwayland listenfd........ ' + have_xwayland_listenfd.to_string(),
' Safe X11 I/O errors...... ' + have_xsetioerrorexithandler.to_string(),
'',
' Tests:',

View file

@ -53,6 +53,12 @@
#include "wayland/meta-xwayland-surface.h"
#include "x11/meta-x11-display-private.h"
#ifdef HAVE_XWAYLAND_LISTENFD
#define XWAYLAND_LISTENFD "-listenfd"
#else
#define XWAYLAND_LISTENFD "-listen"
#endif
static int display_number_override = -1;
static void meta_xwayland_stop_xserver (MetaXWaylandManager *manager);
@ -914,9 +920,9 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
args[i++] = "-core";
args[i++] = "-auth";
args[i++] = manager->auth_file;
args[i++] = "-listen";
args[i++] = XWAYLAND_LISTENFD;
args[i++] = "4";
args[i++] = "-listen";
args[i++] = XWAYLAND_LISTENFD;
args[i++] = "5";
args[i++] = "-displayfd";
args[i++] = "6";
@ -924,7 +930,7 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
args[i++] = "-initfd";
args[i++] = "7";
#else
args[i++] = "-listen";
args[i++] = XWAYLAND_LISTENFD;
args[i++] = "7";
#endif
for (j = 0; j < G_N_ELEMENTS (x11_extension_names); j++)