Make gtk_init_check work as expected

When no GDK backend can be initialized (either because
GDK_BACKEND has been set to the wrong value, or the backends
are simply not included), the expectation is that gtk_init_check
should return FALSE, not error out.
This commit makes it so, by using gdk_display_manager_peek
instead of gdk_display_manager_get in code paths that are used
during initialization.
This commit is contained in:
Matthias Clasen 2013-03-23 19:41:39 -04:00
parent 48d8af85d0
commit 65cd2a59c3

View File

@ -536,22 +536,26 @@ _gtk_modules_init (gint *argc,
gtk_argv [*argc] = NULL;
}
display_manager = gdk_display_manager_get ();
default_display_opened = gdk_display_get_default () != NULL;
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (default_display_notify_cb),
NULL);
g_signal_connect (display_manager, "display-opened",
G_CALLBACK (display_opened_cb),
NULL);
display_manager = gdk_display_manager_peek ();
if (display_manager != NULL)
{
default_display_opened = gdk_display_get_default () != NULL;
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (default_display_notify_cb),
NULL);
g_signal_connect (display_manager, "display-opened",
G_CALLBACK (display_opened_cb),
NULL);
}
if (gtk_modules_args) {
/* Modules specified in the GTK_MODULES environment variable
* or on the command line are always loaded, so we'll just leak
* the refcounts.
*/
g_slist_free (load_modules (gtk_modules_args));
}
if (gtk_modules_args)
{
/* Modules specified in the GTK_MODULES environment variable
* or on the command line are always loaded, so we'll just leak
* the refcounts.
*/
g_slist_free (load_modules (gtk_modules_args));
}
}
static void