[mutter] backend: Add 'prepare-shutdown' signal
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] backend: Add 'prepare-shutdown' signal
- Date: Fri, 12 Mar 2021 15:43:45 +0000 (UTC)
commit b31a639378b8c284096fc194d76b1847e665aa3d
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Feb 3 10:59:06 2021 +0100
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>
src/backends/meta-backend-private.h | 2 ++
src/backends/meta-backend.c | 14 ++++++++++++++
src/core/main.c | 4 ++++
3 files changed, 20 insertions(+)
---
diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h
index 3926a3c63a..0c328ffccd 100644
--- a/src/backends/meta-backend-private.h
+++ b/src/backends/meta-backend-private.h
@@ -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);
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 6b2780eebd..e0249160db 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -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:
*
diff --git a/src/core/main.c b/src/core/main.c
index a6c6fc8562..e204b68ffe 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]