[clutter-gtk] gtk-clutter-util: Put the shared initializion logic in a shared function



commit 7c143f8ba2f76fbae9cd512ae11be436dee310a7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Apr 16 13:28:49 2014 -0400

    gtk-clutter-util: Put the shared initializion logic in a shared function
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695737

 clutter-gtk/gtk-clutter-util.c |   65 ++++++++-------------------------------
 1 files changed, 14 insertions(+), 51 deletions(-)
---
diff --git a/clutter-gtk/gtk-clutter-util.c b/clutter-gtk/gtk-clutter-util.c
index fdd2ba8..db3ff09 100644
--- a/clutter-gtk/gtk-clutter-util.c
+++ b/clutter-gtk/gtk-clutter-util.c
@@ -50,16 +50,11 @@ static const guint clutter_gtk_micro_version = CLUTTER_GTK_MICRO_VERSION;
 
 static gboolean gtk_clutter_is_initialized = FALSE;
 
-static gboolean
-post_parse_hook (GOptionContext  *context,
-                 GOptionGroup    *group,
-                 gpointer         data,
-                 GError         **error)
+static void
+gtk_clutter_init_internal (void)
 {
   GdkDisplay *display;
 
-  gtk_clutter_is_initialized = TRUE;
-
   display = gdk_display_get_default ();
 
 #if defined(CLUTTER_WINDOWING_GDK)
@@ -102,6 +97,17 @@ post_parse_hook (GOptionContext  *context,
    * interfere with gtk accessibility support.
    */
   clutter_disable_accessibility ();
+}
+
+static gboolean
+post_parse_hook (GOptionContext  *context,
+                 GOptionGroup    *group,
+                 gpointer         data,
+                 GError         **error)
+{
+  gtk_clutter_is_initialized = TRUE;
+
+  gtk_clutter_init_internal ();
 
   /* this is required since parsing clutter's option group did not
    * complete the initialization process
@@ -178,8 +184,6 @@ ClutterInitError
 gtk_clutter_init (int    *argc,
                   char ***argv)
 {
-  GdkDisplay *display;
-
   if (gtk_clutter_is_initialized)
     return CLUTTER_INIT_SUCCESS;
 
@@ -188,48 +192,7 @@ gtk_clutter_init (int    *argc,
   if (!gtk_init_check (argc, argv))
     return CLUTTER_INIT_ERROR_UNKNOWN;
 
-  display = gdk_display_get_default ();
-
-#if defined(CLUTTER_WINDOWING_GDK)
-  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_GDK))
-    {
-      clutter_gdk_set_display (gdk_display_get_default ());
-
-      /* let GDK be in charge of the event handling */
-      clutter_gdk_disable_event_retrieval ();
-    }
-  else
-#endif
-#if defined(GDK_WINDOWING_X11) && defined(CLUTTER_WINDOWING_X11)
-  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
-      GDK_IS_X11_DISPLAY (display))
-    {
-      /* enable ARGB visuals by default for Clutter */
-      clutter_x11_set_use_argb_visual (TRUE);
-
-      /* share the X11 Display with GTK+ */
-      clutter_x11_set_display (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
-
-      /* let GTK+ be in charge of the event handling */
-      clutter_x11_disable_event_retrieval ();
-    }
-  else
-#endif
-#if defined(GDK_WINDOWING_WIN32) && defined(CLUTTER_WINDOWING_WIN32)
-  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_WIN32) &&
-      GDK_IS_WIN32_DISPLAY (display))
-    {
-      /* let GTK+ be in charge of the event handling */
-      clutter_win32_disable_event_retrieval ();
-    }
-  else
-#endif
-    g_error ("*** Unsupported backend.");
-
-  /* We disable clutter accessibility support in order to not
-   * interfere with gtk accessibility support.
-   */
-  clutter_disable_accessibility ();
+  gtk_clutter_init_internal ();
 
   return clutter_init (argc, argv);
 }


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