Splash screen: Flush display after drawing.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 5 Sep 2015 05:56:13 +0000 (07:56 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 5 Sep 2015 05:56:35 +0000 (07:56 +0200)
This avoids a few milliseconds of black which some users have reported.

src/ui/gui/main.c

index 9dd4307433ab6a9df9520b7890b8dd242e6c3e20..3cd9863edcffd054af8455cac85150494a124c6e 100644 (file)
@@ -336,9 +336,9 @@ main (int argc, char *argv[])
   g_main_loop_unref (loop);
   g_main_context_unref (context);
 
-  if (win) 
+  if (win)
     g_timeout_add (500, destroy_splash_window, win);
-  
+
   gtk_main ();
 
   /* Not much point in this except to check for memory leaks */
@@ -372,25 +372,35 @@ gboolean
 splash_prepare  (GSource    *source,
            gint       *timeout_)
 {
+  GdkEvent *e = gdk_event_peek ();
+  if (!e)
+    return FALSE;
+
+  gdk_event_free (e);
   return TRUE;
 }
 
 gboolean
 splash_check   (GSource    *source)
 {
+  GdkEvent *e = gdk_event_peek ();
+  if (!e)
+    return FALSE;
+
+  gdk_event_free (e);
   return TRUE;
 }
 
+
 gboolean
 splash_dispatch (GSource *ss,
            GSourceFunc callback,
            gpointer    user_data)
 {
   struct splash_source *source = (struct splash_source *) ss;
-
   GdkEvent *e = gdk_event_get ();
   if (!e)
-    return FALSE;
+    return TRUE;
 
   GdkWindow *w = ((GdkEventAny *)e)->window;
 
@@ -401,8 +411,8 @@ splash_dispatch (GSource *ss,
     }
 
   fill_splash_window (w, source->sfc);
+  gdk_display_flush (gdk_window_get_display (w));
 
-  gdk_window_show (w);
   gdk_event_free (e);
 
   return TRUE;