[Xfce4-commits] [xfce/xfce4-panel] 01/01: Improve the marching ants animation

noreply at xfce.org noreply at xfce.org
Sun Oct 20 12:19:03 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit d8b2e63dc8160db5463cef743d4bf2330558a5fa
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Oct 20 12:18:21 2019 +0200

    Improve the marching ants animation
    
    Previously the panel background would "jump around" if set to "image".
---
 panel/panel-base-window.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index cbcc302..c508bf8 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -38,8 +38,10 @@
 
 #define PANEL_BASE_CSS        ".xfce4-panel.background { border-style: solid; }"\
                               ".xfce4-panel.background button { background: transparent; padding: 0; }"\
-                              ".xfce4-panel.background.marching-ants { border: 1px dashed #ff0000; }"
-
+                              ".xfce4-panel.background.marching-ants-dashed { border: 1px dashed #ff0000; }"\
+                              ".xfce4-panel.background.marching-ants-dotted { border: 1px dotted #ff0000; }"
+#define MARCHING_ANTS_DASHED  "marching-ants-dashed"
+#define MARCHING_ANTS_DOTTED  "marching-ants-dotted"
 
 
 static void     panel_base_window_get_property                (GObject              *object,
@@ -568,13 +570,23 @@ panel_base_window_active_timeout (gpointer user_data)
   GtkStyleContext        *context;
 
   context = gtk_widget_get_style_context (GTK_WIDGET (window));
-  /* Animate the border à la "marching ants" by adding a dashed border
-     and removing it again every other second */
+
+  /* Animate the border à la "marching ants" by cycling betwee a dashed and
+     dotted border every other second */
   g_get_current_time (&timeval);
   if (timeval.tv_sec%2 == 0)
-    gtk_style_context_add_class (context, "marching-ants");
+    {
+      if (gtk_style_context_has_class (context, MARCHING_ANTS_DOTTED))
+        gtk_style_context_remove_class (context, MARCHING_ANTS_DOTTED);
+      gtk_style_context_add_class (context, MARCHING_ANTS_DASHED);
+    }
   else
-    gtk_style_context_remove_class (context, "marching-ants");
+    {
+      if (gtk_style_context_has_class (context, MARCHING_ANTS_DASHED))
+        gtk_style_context_remove_class (context, MARCHING_ANTS_DASHED);
+      gtk_style_context_add_class (context, MARCHING_ANTS_DOTTED);
+    }
+
   gtk_widget_queue_draw (GTK_WIDGET (window));
   return TRUE;
 }
@@ -589,8 +601,12 @@ panel_base_window_active_timeout_destroyed (gpointer user_data)
 
   window->priv->active_timeout_id = 0;
   context = gtk_widget_get_style_context (GTK_WIDGET (window));
+
   /* Stop the marching ants */
-  gtk_style_context_remove_class (context, "marching-ants");
+  if (gtk_style_context_has_class (context, MARCHING_ANTS_DASHED))
+    gtk_style_context_remove_class (context, MARCHING_ANTS_DASHED);
+  if (gtk_style_context_has_class (context, MARCHING_ANTS_DOTTED))
+    gtk_style_context_remove_class (context, MARCHING_ANTS_DOTTED);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list