mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 13:24:09 +00:00
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>
This commit is contained in:
parent
aa306ac3ca
commit
725510ea29
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "compositor/meta-plugin-manager.h"
|
#include "compositor/meta-plugin-manager.h"
|
||||||
#include "meta/main.h"
|
#include "meta/main.h"
|
||||||
#include "meta/meta-enums.h"
|
#include "meta/meta-context.h"
|
||||||
#include "meta/util.h"
|
#include "meta/util.h"
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -59,22 +59,39 @@ GOptionEntry mutter_options[] = {
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
GOptionContext *ctx;
|
g_autoptr (MetaContext) context = NULL;
|
||||||
GError *error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
|
|
||||||
ctx = meta_get_option_context ();
|
context = meta_create_context ("Mutter");
|
||||||
g_option_context_add_main_entries (ctx, mutter_options, GETTEXT_PACKAGE);
|
|
||||||
if (!g_option_context_parse (ctx, &argc, &argv, &error))
|
meta_context_add_option_entries (context, mutter_options, GETTEXT_PACKAGE);
|
||||||
|
if (!meta_context_configure (context, &argc, &argv, &error))
|
||||||
{
|
{
|
||||||
g_printerr ("mutter: %s\n", error->message);
|
g_printerr ("Failed to configure: %s", error->message);
|
||||||
exit (1);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
g_option_context_free (ctx);
|
|
||||||
|
|
||||||
if (plugin)
|
meta_context_set_plugin_name (context, plugin);
|
||||||
meta_plugin_manager_load (plugin);
|
|
||||||
|
|
||||||
meta_init ();
|
if (!meta_context_setup (context, &error))
|
||||||
meta_register_with_session ();
|
{
|
||||||
return meta_run ();
|
g_printerr ("Failed to setup: %s", error->message);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user