[mutter] main: Split up meta_run() into meta_start() and meta_run_main_loop()
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] main: Split up meta_run() into meta_start() and meta_run_main_loop()
- Date: Thu, 13 Aug 2020 16:00:31 +0000 (UTC)
commit 06d5973851ac6ef3f6dc2387abe39d32632e3d42
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Jul 9 21:21:55 2020 +0200
main: Split up meta_run() into meta_start() and meta_run_main_loop()
meta_run() is still left intact and does the same as before; the new
functions are only intended to be used by tests, as they may need to set
things up after starting up. Doing so linearly in the test case is much
easier than adding callbacks, so meta_run() is split up to make this
possible.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
src/core/main-private.h | 6 ++++++
src/core/main.c | 27 ++++++++++++++++++---------
2 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/src/core/main-private.h b/src/core/main-private.h
index be6b1cef3d..c37ce8cd62 100644
--- a/src/core/main-private.h
+++ b/src/core/main-private.h
@@ -51,4 +51,10 @@ void meta_override_compositor_configuration (MetaCompositorType compositor_type,
MetaDisplayPolicy meta_get_x11_display_policy (void);
+META_EXPORT_TEST
+void meta_start (void);
+
+META_EXPORT_TEST
+void meta_run_main_loop (void);
+
#endif /* META_MAIN_PRIVATE_H */
diff --git a/src/core/main.c b/src/core/main.c
index 16ab6e81f0..2a7cb4eafd 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -642,6 +642,22 @@ meta_register_with_session (void)
g_free (opt_client_id);
}
+void
+meta_start (void)
+{
+ meta_prefs_init ();
+ meta_prefs_add_listener (prefs_changed_callback, NULL);
+
+ if (!meta_display_open ())
+ meta_exit (META_EXIT_ERROR);
+}
+
+void
+meta_run_main_loop (void)
+{
+ g_main_loop_run (meta_main_loop);
+}
+
/**
* meta_run: (skip)
*
@@ -653,15 +669,8 @@ meta_register_with_session (void)
int
meta_run (void)
{
- /* Load prefs */
- meta_prefs_init ();
- meta_prefs_add_listener (prefs_changed_callback, NULL);
-
- if (!meta_display_open ())
- meta_exit (META_EXIT_ERROR);
-
- g_main_loop_run (meta_main_loop);
-
+ meta_start ();
+ meta_run_main_loop ();
meta_finalize ();
return meta_exit_code;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]