summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2021-03-03 11:40:55 +0100
committerJonas Ådahl <jadahl@gmail.com>2021-07-15 11:25:21 +0200
commit725510ea2919beec0a2c4a8f4b34b66e470e6345 (patch)
tree04da0bf38e1cbbb97760b762c1d1fcfbe7eda5e9
parentaa306ac3ca0842ba9183cf0ede8c5ec964204de3 (diff)
downloadmutter-725510ea2919beec0a2c4a8f4b34b66e470e6345.tar.gz
mutter: Port to MetaContext
Uses the new MetaContextMain, replacing piece by piece "real display server" setup done using mostly main.c functions. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
-rw-r--r--src/core/mutter.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/src/core/mutter.c b/src/core/mutter.c
index 811e1f92b..9d716014a 100644
--- a/src/core/mutter.c
+++ b/src/core/mutter.c
@@ -25,7 +25,7 @@
#include "compositor/meta-plugin-manager.h"
#include "meta/main.h"
-#include "meta/meta-enums.h"
+#include "meta/meta-context.h"
#include "meta/util.h"
static gboolean
@@ -59,22 +59,39 @@ GOptionEntry mutter_options[] = {
int
main (int argc, char **argv)
{
- GOptionContext *ctx;
- GError *error = NULL;
+ g_autoptr (MetaContext) context = NULL;
+ g_autoptr (GError) error = NULL;
- ctx = meta_get_option_context ();
- g_option_context_add_main_entries (ctx, mutter_options, GETTEXT_PACKAGE);
- if (!g_option_context_parse (ctx, &argc, &argv, &error))
+ context = meta_create_context ("Mutter");
+
+ meta_context_add_option_entries (context, mutter_options, GETTEXT_PACKAGE);
+ if (!meta_context_configure (context, &argc, &argv, &error))
+ {
+ g_printerr ("Failed to configure: %s", error->message);
+ return EXIT_FAILURE;
+ }
+
+ meta_context_set_plugin_name (context, plugin);
+
+ if (!meta_context_setup (context, &error))
{
- g_printerr ("mutter: %s\n", error->message);
- exit (1);
+ g_printerr ("Failed to setup: %s", error->message);
+ return EXIT_FAILURE;
}
- g_option_context_free (ctx);
- if (plugin)
- meta_plugin_manager_load (plugin);
+ if (!meta_context_start (context, &error))
+ {
+ g_printerr ("Failed to start: %s", error->message);
+ return EXIT_FAILURE;
+ }
+
+ meta_context_notify_ready (context);
+
+ if (!meta_context_run_main_loop (context, &error))
+ {
+ g_printerr ("Mutter terminated with a failure: %s", error->message);
+ return EXIT_FAILURE;
+ }
- meta_init ();
- meta_register_with_session ();
- return meta_run ();
+ return EXIT_SUCCESS;
}