main: Remove meta_test_init()

This was the last user of the configuration override API, so that goes
as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
Jonas Ådahl 2021-03-03 12:10:06 +01:00
parent 1d4224ab07
commit fe0ce2814e
3 changed files with 5 additions and 112 deletions

View File

@ -21,7 +21,6 @@
#define META_MAIN_PRIVATE_H
#include "core/util-private.h"
#include "meta/meta-enums.h"
typedef enum _MetaX11DisplayPolicy
{
@ -30,12 +29,6 @@ typedef enum _MetaX11DisplayPolicy
META_X11_DISPLAY_POLICY_DISABLED,
} MetaX11DisplayPolicy;
META_EXPORT_TEST
void meta_override_compositor_configuration (MetaCompositorType compositor_type,
GType backend_gtype,
const char *first_property_name,
...);
META_EXPORT_TEST
MetaX11DisplayPolicy meta_get_x11_display_policy (void);

View File

@ -661,66 +661,6 @@ calculate_compositor_configuration (MetaCompositorType *compositor_type,
}
}
static gboolean _compositor_configuration_overridden = FALSE;
static MetaCompositorType _compositor_type_override;
static GType _backend_gtype_override;
static GArray *_backend_property_names;
static GArray *_backend_property_values;
void
meta_override_compositor_configuration (MetaCompositorType compositor_type,
GType backend_gtype,
const char *first_property_name,
...)
{
va_list var_args;
GArray *names;
GArray *values;
GObjectClass *object_class;
const char *property_name;
names = g_array_new (FALSE, FALSE, sizeof (const char *));
values = g_array_new (FALSE, FALSE, sizeof (GValue));
g_array_set_clear_func (values, (GDestroyNotify) g_value_unset);
object_class = g_type_class_ref (backend_gtype);
property_name = first_property_name;
va_start (var_args, first_property_name);
while (property_name)
{
GValue value = G_VALUE_INIT;
GParamSpec *pspec;
GType ptype;
char *error = NULL;
pspec = g_object_class_find_property (object_class,
property_name);
g_assert (pspec);
ptype = G_PARAM_SPEC_VALUE_TYPE (pspec);
G_VALUE_COLLECT_INIT (&value, ptype, var_args, 0, &error);
g_assert (!error);
g_array_append_val (names, property_name);
g_array_append_val (values, value);
property_name = va_arg (var_args, const char *);
}
va_end (var_args);
g_type_class_unref (object_class);
_compositor_configuration_overridden = TRUE;
_compositor_type_override = compositor_type;
_backend_gtype_override = backend_gtype;
_backend_property_names = names;
_backend_property_values = values;
}
/**
* meta_init: (skip)
*
@ -756,22 +696,11 @@ meta_init (void)
meta_init_debug_utils ();
if (_compositor_configuration_overridden)
{
compositor_type = _compositor_type_override;
backend_gtype = _backend_gtype_override;
n_properties = _backend_property_names->len;
prop_names = (const char **) _backend_property_names->data;
prop_values = (GValue *) _backend_property_values->data;
}
else
{
calculate_compositor_configuration (&compositor_type,
&backend_gtype,
&n_properties,
&prop_names,
&prop_values);
}
calculate_compositor_configuration (&compositor_type,
&backend_gtype,
&n_properties,
&prop_names,
&prop_values);
#ifdef HAVE_WAYLAND
if (compositor_type == META_COMPOSITOR_TYPE_WAYLAND)
@ -801,12 +730,6 @@ meta_init (void)
for (i = 0; i < n_properties; i++)
g_value_reset (&prop_values[i]);
if (_backend_property_names)
{
g_array_free (_backend_property_names, TRUE);
g_array_free (_backend_property_values, TRUE);
}
#ifdef HAVE_NATIVE_BACKEND
add_persistent_virtual_monitors ();
#endif
@ -976,23 +899,3 @@ meta_get_x11_display_policy (void)
return META_X11_DISPLAY_POLICY_MANDATORY;
}
void
meta_test_init (void)
{
#if defined(HAVE_WAYLAND)
g_autofree char *display_name = g_strdup ("mutter-test-display-XXXXXX");
int fd = g_mkstemp (display_name);
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
META_TYPE_BACKEND_X11_NESTED,
NULL);
meta_wayland_override_display_name (display_name);
meta_xwayland_override_display_number (512 + rand() % 512);
meta_init ();
close (fd);
#else
g_warning ("Tests require wayland support");
#endif
}

View File

@ -72,9 +72,6 @@ void meta_exit (MetaExitCode code) G_GNUC_NORETURN;
META_EXPORT
void meta_quit (MetaExitCode code);
META_EXPORT
void meta_test_init (void);
META_EXPORT
void meta_start (void);