[gtk+/wip/paint-clock: 2/4] gtk_init(): initialise the GDK global GPeriodic



commit 079366259a87ca82be6a78eb075b6d65bda0f0a2
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Oct 20 13:46:37 2010 +0200

    gtk_init(): initialise the GDK global GPeriodic
    
    Initialise the GDK global periodic clock object from gtk_init() if
    nobody installed one before us.

 gdk/gdk.c     |    3 +++
 gtk/gtkmain.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index bc67b4c..4a5eb99 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -823,6 +823,9 @@ gdk_enable_multidevice (void)
  * you should check with gdk_threads_get_periodic() to ensure that it is
  * %NULL before attempting to call this function.
  *
+ * gtk_init() will set the default clock if it has not already been set,
+ * so you need to call this function before you call gtk_init().
+ *
  * Since: 3.0
  **/
 void
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index a4d067a..f4f3a4c 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1068,6 +1068,9 @@ gtk_init_check (int	 *argc,
   if (!gtk_parse_args (argc, argv))
     return FALSE;
 
+  if (gdk_threads_get_periodic () == NULL)
+    gdk_threads_set_periodic (g_periodic_new (60, GDK_PRIORITY_REDRAW));
+
   return gdk_display_open_default_libgtk_only () != NULL;
 }
 



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