[mutter] wayland: Make init and shutdown symmetric
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Make init and shutdown symmetric
- Date: Tue, 18 May 2021 14:31:20 +0000 (UTC)
commit 301d2c55c61f8d61bb8391c2edfa8ca1ec6f60b1
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu May 6 20:58:06 2021 +0200
wayland: Make init and shutdown symmetric
We first initialized the Wayland infrastructure, then the display, but
on shutdown, we first teared down the Wayland infrastructure, then the
display.
Make things a bit more symmetric and tear down the display before
Wayland. This however means we need to tear down some things Wayland a
bit earlier than the rest. For now this is a separate function, but
eventually, it can be replaced with a signal shared by the backend's
'prepare-shutdown' signal.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
src/core/main.c | 12 ++++++++++--
src/wayland/meta-wayland.c | 14 +++++++++-----
src/wayland/meta-wayland.h | 2 ++
3 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index 9b5a3acb5b..b7b5d14490 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -308,19 +308,27 @@ meta_finalize (void)
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
+#ifdef HAVE_WAYLAND
+ MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
+#endif
if (backend)
meta_backend_prepare_shutdown (backend);
#ifdef HAVE_WAYLAND
- if (meta_is_wayland_compositor ())
- meta_wayland_finalize ();
+ if (compositor)
+ meta_wayland_compositor_prepare_shutdown (compositor);
#endif
if (display)
meta_display_close (display,
META_CURRENT_TIME); /* I doubt correct timestamps matter here */
+#ifdef HAVE_WAYLAND
+ if (meta_is_wayland_compositor ())
+ meta_wayland_finalize ();
+#endif
+
#ifdef HAVE_NATIVE_BACKEND
release_virtual_monitors ();
#endif
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 4145e65c8f..4febb7d061 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -614,16 +614,20 @@ meta_wayland_get_private_xwayland_display_name (MetaWaylandCompositor *composito
}
void
-meta_wayland_finalize (void)
+meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor)
{
- MetaWaylandCompositor *compositor;
-
- compositor = meta_wayland_compositor_get_default ();
-
meta_xwayland_shutdown (&compositor->xwayland_manager);
if (compositor->wayland_display)
wl_display_destroy_clients (compositor->wayland_display);
+}
+
+void
+meta_wayland_finalize (void)
+{
+ MetaWaylandCompositor *compositor;
+
+ compositor = meta_wayland_compositor_get_default ();
g_clear_pointer (&compositor->seat, meta_wayland_seat_free);
diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h
index 6c655e427b..38700cedd9 100644
--- a/src/wayland/meta-wayland.h
+++ b/src/wayland/meta-wayland.h
@@ -41,6 +41,8 @@ MetaWaylandCompositor * meta_wayland_compositor_new (MetaBackend *ba
void meta_wayland_compositor_setup (MetaWaylandCompositor *compositor);
+void meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor);
+
META_EXPORT_TEST
MetaWaylandCompositor *meta_wayland_compositor_get_default (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]