Fix accessibility not getting initialized in gtk_init() if a default display is already set

_gtk_accessibility_init() only gets called if the default
display changes, but in case gdk_init() is called before gtk_init()
the default display is already set and no property notification occurs.

This can happen quite easily in pygobject where
"from gi.repository import Gdk, Gtk"
will call gdk_init() followed by gtk_init() in the Python overrides.

This fixes it by checking for a default display in all cases.
This commit is contained in:
Christoph Reiter 2015-10-07 00:00:35 +02:00 committed by Christoph Reiter
parent ecb0e777fa
commit 263cbd90a0

View File

@ -698,6 +698,8 @@ static void
do_post_parse_initialization (int *argc,
char ***argv)
{
GdkDisplayManager *display_manager;
if (gtk_initialized)
return;
@ -737,7 +739,11 @@ do_post_parse_initialization (int *argc,
_gtk_modules_init (argc, argv, NULL);
}
g_signal_connect (gdk_display_manager_get (), "notify::default-display",
display_manager = gdk_display_manager_get ();
if (gdk_display_manager_get_default_display (display_manager) != NULL)
_gtk_accessibility_init ();
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (default_display_notify_cb),
NULL);
}