xwayland: Add a setting to disable selected X extensions

The X server, including Xwayland, can be compiled with different X11
extensions enabled at build time.

When an X11 extension is built in the X server, it's usually also
enabled at run time. Users can chose to disable those extensions at run
time using the X server command line option "-extension".

However, in the case of Xwayland, it is spawned automatically by the
Wayland compositor, and the command line options are not configurable
by users.

Add a new setting to disable a selected set of X extension in Xwayland
at startup, without needing to rebuild Xwayland.

Of course, if Xwayland is not built with a given extension support in
the first place (which is the default for the security extension for
example), that option has no effect.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1405
This commit is contained in:
Olivier Fourdan
2020-08-12 19:30:04 +02:00
committed by Robert Mader
parent e44c42f254
commit 5171e35a97
4 changed files with 108 additions and 14 deletions

View File

@ -68,6 +68,9 @@ struct _MetaSettings
gboolean xwayland_allow_grabs;
GPtrArray *xwayland_grab_allow_list_patterns;
GPtrArray *xwayland_grab_deny_list_patterns;
/* A bitmask of MetaXwaylandExtension enum */
int xwayland_disable_extensions;
};
G_DEFINE_TYPE (MetaSettings, meta_settings, G_TYPE_OBJECT)
@ -387,6 +390,14 @@ update_xwayland_allow_grabs (MetaSettings *settings)
"xwayland-allow-grabs");
}
static void
update_xwayland_disable_extensions (MetaSettings *settings)
{
settings->xwayland_disable_extensions =
g_settings_get_flags (settings->wayland_settings,
"xwayland-disable-extension");
}
static void
wayland_settings_changed (GSettings *wayland_settings,
gchar *key,
@ -401,6 +412,10 @@ wayland_settings_changed (GSettings *wayland_settings,
{
update_xwayland_grab_access_rules (settings);
}
else if (g_str_equal (key, "xwayland-disable-extension"))
{
update_xwayland_disable_extensions (settings);
}
}
void
@ -418,6 +433,12 @@ meta_settings_are_xwayland_grabs_allowed (MetaSettings *settings)
return (settings->xwayland_allow_grabs);
}
int
meta_settings_get_xwayland_disable_extensions (MetaSettings *settings)
{
return (settings->xwayland_disable_extensions);
}
MetaSettings *
meta_settings_new (MetaBackend *backend)
{
@ -471,6 +492,7 @@ meta_settings_init (MetaSettings *settings)
update_experimental_features (settings);
update_xwayland_grab_access_rules (settings);
update_xwayland_allow_grabs (settings);
update_xwayland_disable_extensions (settings);
}
static void