[mutter] main: Temporarily tie meta_quit() to meta_context_terminate*()
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] main: Temporarily tie meta_quit() to meta_context_terminate*()
- Date: Thu, 15 Jul 2021 12:40:53 +0000 (UTC)
commit 6732e3e585505e157da7d0884ff40d1fdb2a415b
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Mar 2 15:27:45 2021 +0100
main: Temporarily tie meta_quit() to meta_context_terminate*()
Makes it possible for mutter internally to use meta_quit() both if we're
running using a MetaContext or the scattered functions.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
src/core/main.c | 26 ++++++++++++++++++++++++--
src/core/meta-context.c | 21 +++++++++++++++++++++
2 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index 302a2a86ad..3c47b5aa24 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -83,7 +83,7 @@
#include "core/util-private.h"
#include "meta/compositor.h"
#include "meta/meta-backend.h"
-#include "meta/meta-enums.h"
+#include "meta/meta-context.h"
#include "meta/meta-x11-errors.h"
#include "ui/ui.h"
#include "x11/session.h"
@@ -888,6 +888,9 @@ meta_run (void)
return meta_exit_code;
}
+MetaContext *
+meta_get_context_temporary (void);
+
/**
* meta_quit:
* @code: The success or failure code to return to the calling process.
@@ -901,11 +904,30 @@ meta_run (void)
void
meta_quit (MetaExitCode code)
{
- if (g_main_loop_is_running (meta_main_loop))
+ MetaContext *context;
+
+ if (meta_main_loop && g_main_loop_is_running (meta_main_loop))
{
meta_exit_code = code;
g_main_loop_quit (meta_main_loop);
}
+
+ context = meta_get_context_temporary ();
+ if (context)
+ {
+ if (code == META_EXIT_SUCCESS)
+ {
+ meta_context_terminate (context);
+ }
+ else
+ {
+ GError *error;
+
+ error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Exited with failure status");
+ meta_context_terminate_with_error (context, error);
+ }
+ }
}
MetaExitCode
diff --git a/src/core/meta-context.c b/src/core/meta-context.c
index 9cd12fe216..491cfe9387 100644
--- a/src/core/meta-context.c
+++ b/src/core/meta-context.c
@@ -354,6 +354,24 @@ meta_context_finalize (GObject *object)
G_OBJECT_CLASS (meta_context_parent_class)->finalize (object);
}
+/*
+ * NOTE!
+ *
+ * This global singletone is a temporary stop-gap solution
+ * to allow migrating to MetaContext in smaller steps. It will
+ * be removed later in this series of changes.
+ */
+static MetaContext *_context_temporary;
+
+MetaContext *
+meta_get_context_temporary (void);
+
+MetaContext *
+meta_get_context_temporary (void)
+{
+ return _context_temporary;
+}
+
static void
meta_context_class_init (MetaContextClass *klass)
{
@@ -379,6 +397,9 @@ meta_context_class_init (MetaContextClass *klass)
static void
meta_context_init (MetaContext *context)
{
+ g_assert (!_context_temporary);
+ _context_temporary = context;
+
if (!setlocale (LC_ALL, ""))
g_warning ("Locale not understood by C library");
bindtextdomain (GETTEXT_PACKAGE, MUTTER_LOCALEDIR);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]