diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f0974333..963b7885d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -180,7 +180,7 @@ build: needs: ["check_commit_log"] before_script: - .gitlab-ci/checkout-mutter.sh - - meson mutter mutter/build --prefix=/usr -Dtests=false + - meson mutter mutter/build --prefix=/usr - ninja -C mutter/build install script: - meson . build -Dbuildtype=debugoptimized -Dman=false --werror diff --git a/meson.build b/meson.build index f0a2b4c55..a68a4065b 100644 --- a/meson.build +++ b/meson.build @@ -17,6 +17,7 @@ clutter_pc = 'mutter-clutter-' + mutter_api_version cogl_pc = 'mutter-cogl-' + mutter_api_version cogl_pango_pc = 'mutter-cogl-pango-' + mutter_api_version libmutter_pc = 'libmutter-' + mutter_api_version +libmutter_test_pc = 'libmutter-test-' + mutter_api_version ecal_req = '>= 3.33.1' eds_req = '>= 3.33.1' @@ -87,6 +88,7 @@ clutter_dep = dependency(clutter_pc, version: mutter_req) cogl_dep = dependency(cogl_pc, version: mutter_req) cogl_pango_dep = dependency(cogl_pango_pc, version: mutter_req) mutter_dep = dependency(libmutter_pc, version: mutter_req) +mutter_test_dep = dependency(libmutter_test_pc, version: mutter_req) polkit_dep = dependency('polkit-agent-1', version: polkit_req) startup_dep = dependency('libstartup-notification-1.0', version: startup_req) ibus_dep = dependency('ibus-1.0', version: ibus_req) diff --git a/src/main.c b/src/main.c index a47154db1..1eb0b1a29 100644 --- a/src/main.c +++ b/src/main.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -442,33 +442,35 @@ GOptionEntry gnome_shell_options[] = { int main (int argc, char **argv) { - GOptionContext *ctx; + g_autoptr (MetaContext) context = NULL; GError *error = NULL; - int ecode; + int ecode = EXIT_SUCCESS; bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); + context = meta_create_context (WM_NAME); + meta_context_add_option_entries (context, gnome_shell_options, + GETTEXT_PACKAGE); + meta_context_add_option_group (context, g_irepository_get_option_group ()); + session_mode = (char *) g_getenv ("GNOME_SHELL_SESSION_MODE"); - ctx = meta_get_option_context (); - g_option_context_add_main_entries (ctx, gnome_shell_options, GETTEXT_PACKAGE); - g_option_context_add_group (ctx, g_irepository_get_option_group ()); - if (!g_option_context_parse (ctx, &argc, &argv, &error)) + if (!meta_context_configure (context, &argc, &argv, &error)) { - g_printerr ("%s: %s\n", argv[0], error->message); - exit (1); + g_printerr ("Failed to configure: %s", error->message); + return EXIT_FAILURE; } - g_option_context_free (ctx); + meta_context_set_plugin_gtype (context, gnome_shell_plugin_get_type ()); + meta_context_set_gnome_wm_keybindings (context, GNOME_WM_KEYBINDINGS); - meta_plugin_manager_set_plugin_type (gnome_shell_plugin_get_type ()); - - meta_set_wm_name (WM_NAME); - meta_set_gnome_wm_keybindings (GNOME_WM_KEYBINDINGS); - - meta_init (); + if (!meta_context_setup (context, &error)) + { + g_printerr ("Failed to setup: %s", error->message); + return EXIT_FAILURE; + } /* FIXME: Add gjs API to set this stuff and don't depend on the * environment. These propagate to child processes. @@ -478,7 +480,7 @@ main (int argc, char **argv) shell_init_debug (g_getenv ("SHELL_DEBUG")); - shell_dbus_init (meta_get_replace_current_wm ()); + shell_dbus_init (meta_context_is_replacing (context)); shell_a11y_init (); shell_perf_log_init (); shell_introspection_init (); @@ -504,7 +506,21 @@ main (int argc, char **argv) } shell_profiler_init (); - ecode = meta_run (); + + if (!meta_context_start (context, &error)) + { + g_printerr ("GNOME Shell failed to start: %s", error->message); + return EXIT_FAILURE; + } + + if (!meta_context_run_main_loop (context, &error)) + { + g_printerr ("GNOME Shell terminated with an error: %s", error->message); + ecode = EXIT_FAILURE; + } + + meta_context_destroy (g_steal_pointer (&context)); + shell_profiler_shutdown (); g_debug ("Doing final cleanup"); diff --git a/src/st/meson.build b/src/st/meson.build index a74581ff8..8e4acdaaa 100644 --- a/src/st/meson.build +++ b/src/st/meson.build @@ -194,7 +194,7 @@ libst_dep = declare_dependency(link_with: libst, test_theme = executable('test-theme', sources: 'test-theme.c', c_args: st_cflags, - dependencies: [mutter_dep, gtk_dep, libxml_dep], + dependencies: [mutter_test_dep, gtk_dep, libxml_dep], build_rpath: mutter_typelibdir, link_with: libst ) diff --git a/src/st/test-theme.c b/src/st/test-theme.c index cbc79f6b5..3fcbd99bb 100644 --- a/src/st/test-theme.c +++ b/src/st/test-theme.c @@ -25,7 +25,7 @@ #include "st-button.h" #include #include -#include +#include #include static ClutterActor *stage; @@ -538,6 +538,8 @@ test_inline_style (void) int main (int argc, char **argv) { + MetaContext *context; + g_autoptr (GError) error = NULL; MetaBackend *backend; StTheme *theme; StThemeContext *theme_context; @@ -550,7 +552,13 @@ main (int argc, char **argv) /* meta_init() cds to $HOME */ cwd = g_get_current_dir (); - meta_test_init (); + context = meta_create_test_context (META_CONTEXT_TEST_TYPE_NESTED, + META_CONTEXT_TEST_FLAG_NONE); + if (!meta_context_configure (context, &argc, &argv, &error)) + g_error ("Failed to configure: %s", error->message); + + if (!meta_context_setup (context, &error)) + g_error ("Failed to setup: %s", error->message); if (chdir (cwd) < 0) g_error ("chdir('%s') failed: %s", cwd, g_strerror (errno)); @@ -623,7 +631,7 @@ main (int argc, char **argv) g_object_unref (text4); g_object_unref (theme); - clutter_actor_destroy (stage); + g_object_unref (context); return fail ? 1 : 0; }