mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 19:10:43 -05:00
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>
This commit is contained in:
parent
c9992a2953
commit
89053cc6f7
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user