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>
This commit is contained in:
Jonas Ådahl
2021-05-06 20:58:06 +02:00
committed by Marge Bot
parent dc97163bcd
commit 301d2c55c6
3 changed files with 21 additions and 7 deletions

View File

@@ -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