From a55bad61f8a5370b30334b4a553a71eef7059568 Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Sat, 5 Sep 2015 07:56:13 +0200
Subject: [PATCH] Splash screen: Flush display after drawing.

This avoids a few milliseconds of black which some users have reported.
---
 src/ui/gui/main.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c
index 9dd4307433..3cd9863edc 100644
--- a/src/ui/gui/main.c
+++ b/src/ui/gui/main.c
@@ -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;
-- 
2.30.2