backend: Add 'prepare-shutdown' signal

This will be used to avoid doing various work when we're shutting down,
e.g. react to changes triggering monitor reconfigurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
Jonas Ådahl 2021-02-03 10:59:06 +01:00 committed by Marge Bot
parent a0e4f5226c
commit b31a639378
3 changed files with 20 additions and 0 deletions

View File

@ -110,6 +110,8 @@ void meta_init_backend (GType backend_gtype,
const GValue *values);
void meta_release_backend (void);
void meta_backend_prepare_shutdown (MetaBackend *backend);
#ifdef HAVE_WAYLAND
MetaWaylandCompositor * meta_backend_get_wayland_compositor (MetaBackend *backend);

View File

@ -94,6 +94,7 @@ enum
LAST_DEVICE_CHANGED,
LID_IS_CLOSED_CHANGED,
GPU_ADDED,
PREPARE_SHUTDOWN,
N_SIGNALS
};
@ -869,6 +870,13 @@ meta_backend_class_init (MetaBackendClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, META_TYPE_GPU);
signals[PREPARE_SHUTDOWN] =
g_signal_new ("prepare-shutdown",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
mutter_stage_views = g_getenv ("MUTTER_STAGE_VIEWS");
stage_views_disabled = g_strcmp0 (mutter_stage_views, "0") == 0;
@ -1485,6 +1493,12 @@ meta_release_backend (void)
g_clear_object (&_backend);
}
void
meta_backend_prepare_shutdown (MetaBackend *backend)
{
g_signal_emit (backend, signals[PREPARE_SHUTDOWN], 0);
}
/**
* meta_is_stage_views_enabled:
*

View File

@ -344,6 +344,10 @@ static void
meta_finalize (void)
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
if (backend)
meta_backend_prepare_shutdown (backend);
if (display)
meta_display_close (display,