[gtk+/gtk-3-18] Fix accessibility not getting initialized in gtk_init() if a default display is already set



commit da2f672c11eceee52eb5160d914f35d14a04d711
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Wed Oct 7 00:00:35 2015 +0200

    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.

 gtk/gtkmain.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index c2a439c..0a14f20 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]