[mutter] display: Make meta_display_open() report errors
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] display: Make meta_display_open() report errors
- Date: Mon, 17 May 2021 16:34:29 +0000 (UTC)
commit 89053cc6f772ab3715ed775b8aba234a6a6a5ce4
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Feb 25 21:03:54 2021 +0100
display: Make meta_display_open() report errors
Instead of just exit():ing, report the error, so the caller can decide
how to deal with the error.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
src/core/display-private.h | 2 +-
src/core/display.c | 16 +++++++++-------
src/core/main.c | 9 +++++++--
3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 3d690fcb66..6008de05fe 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -260,7 +260,7 @@ struct _MetaDisplayClass
(time2) != 0) \
)
-gboolean meta_display_open (void);
+gboolean meta_display_open (GError **error);
void meta_display_manage_all_xwindows (MetaDisplay *display);
void meta_display_unmanage_windows (MetaDisplay *display,
diff --git a/src/core/display.c b/src/core/display.c
index 5cdfce5eef..0ce0e1c0a6 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -798,9 +798,8 @@ meta_display_shutdown_x11 (MetaDisplay *display)
* has a window manager.
*/
gboolean
-meta_display_open (void)
+meta_display_open (GError **error)
{
- GError *error = NULL;
MetaDisplay *display;
int i;
guint32 timestamp;
@@ -902,8 +901,11 @@ meta_display_open (void)
else
#endif
{
- if (!meta_display_init_x11_display (display, &error))
- g_error ("Failed to init X11 display: %s", error->message);
+ if (!meta_display_init_x11_display (display, error))
+ {
+ g_object_unref (display);
+ return FALSE;
+ }
timestamp = display->x11_display->timestamp;
}
@@ -917,10 +919,10 @@ meta_display_open (void)
display->x11_display->atom__NET_ACTIVE_WINDOW,
&old_active_xwindow);
- if (!meta_compositor_do_manage (display->compositor, &error))
+ if (!meta_compositor_do_manage (display->compositor, error))
{
- g_error ("Compositor failed to manage display: %s",
- error->message);
+ g_object_unref (display);
+ return FALSE;
}
if (display->x11_display)
diff --git a/src/core/main.c b/src/core/main.c
index 76d3ef5df0..888753732c 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -850,6 +850,8 @@ meta_register_with_session (void)
void
meta_start (void)
{
+ g_autoptr (GError) error = NULL;
+
meta_prefs_init ();
#ifdef HAVE_WAYLAND
@@ -857,8 +859,11 @@ meta_start (void)
meta_backend_init_wayland (meta_get_backend ());
#endif
- if (!meta_display_open ())
- meta_exit (META_EXIT_ERROR);
+ if (!meta_display_open (&error))
+ {
+ g_warning ("Failed to open display: %s", error->message);
+ meta_exit (META_EXIT_ERROR);
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]