[epiphany] Delay hiding the statusbar overlay when the status text changes.



commit d1d329e512877f34d2109e65a267c883e0c87b06
Author: Martin Robinson <mrobinson webkit org>
Date:   Sun Nov 27 11:34:07 2011 +0100

    Delay hiding the statusbar overlay when the status text changes.
    
    Delaying the statusbar hide prevents the overlay from flickering
    when moving the cursor over a series of links.

 embed/ephy-embed.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 623c659..36c6126 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -87,6 +87,7 @@ struct _EphyEmbedPrivate
   guint seq_message_id;
 
   guint tab_message_id;
+  guint pop_statusbar_later_source_id;
 };
 
 G_DEFINE_TYPE (EphyEmbed, ephy_embed, GTK_TYPE_BOX)
@@ -439,6 +440,17 @@ _ephy_embed_set_statusbar_label (EphyEmbed *embed, const char *label)
     gtk_widget_show (parent);
 }
 
+static gboolean
+pop_statusbar_later_cb (gpointer data)
+{
+  EphyEmbed *embed = EPHY_EMBED (data);
+  EphyEmbedPrivate *priv = embed->priv;
+
+  ephy_embed_statusbar_pop (embed, priv->tab_message_id);
+  priv->pop_statusbar_later_source_id = 0;
+  return FALSE;
+}
+
 static void
 status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed)
 {
@@ -449,10 +461,19 @@ status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed
 
   priv = embed->priv;
 
-  ephy_embed_statusbar_pop (embed, priv->tab_message_id);
+  if (message) {
+    if (priv->pop_statusbar_later_source_id) {
+      g_source_remove (priv->pop_statusbar_later_source_id);
+      priv->pop_statusbar_later_source_id = 0;
+    }
 
-  if (message)
+    ephy_embed_statusbar_pop (embed, priv->tab_message_id);
     ephy_embed_statusbar_push (embed, priv->tab_message_id, message);
+  } else {
+    /* A short timeout before hiding the statusbar ensures that while moving
+      over a series of links, the overlay widget doesn't flicker on and off. */
+    priv->pop_statusbar_later_source_id = g_timeout_add (250, pop_statusbar_later_cb, embed);
+  }
 }
 
 static void



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