[Xfce4-commits] [xfce/xfce4-panel] 01/01: panel: Fix autohide state machine

noreply at xfce.org noreply at xfce.org
Mon Feb 24 22:28:46 CET 2020


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 8cadeac921200b892c8f575a7447d17c9d89c61b
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Mon Feb 24 22:24:34 2020 +0100

    panel: Fix autohide state machine
    
    Previously in some cases the panel's autohide state would go out of
    sync, leaving the panel visible when it should be hidden. In other cases
    the cancellation of autohide timeouts lead to unwanted flickering.
---
 panel/panel-window.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/panel/panel-window.c b/panel/panel-window.c
index fecacd8..8995ea4 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -990,13 +990,17 @@ panel_window_enter_notify_event (GtkWidget        *widget,
     {
       /* stop a running autohide timeout */
       if (window->autohide_timeout_id != 0)
-        g_source_remove (window->autohide_timeout_id);
+        {
+          window->autohide_state = AUTOHIDE_VISIBLE;
+          g_source_remove (window->autohide_timeout_id);
+        }
 
-      if (window->autohide_ease_out_id != 0) {
-        g_source_remove (window->autohide_ease_out_id);
-        /* we were in a ease_out animation so restore the original position of the window */
-        panel_window_autohide_queue (window, AUTOHIDE_VISIBLE);
-      }
+      if (window->autohide_ease_out_id != 0)
+        {
+          g_source_remove (window->autohide_ease_out_id);
+          /* we were in a ease_out animation so restore the original position of the window */
+          panel_window_autohide_queue (window, AUTOHIDE_VISIBLE);
+        }
 
       /* update autohide status */
       if (window->autohide_state == AUTOHIDE_POPDOWN)
@@ -1428,6 +1432,10 @@ panel_window_size_allocate (GtkWidget     *widget,
   if (G_UNLIKELY (window->autohide_state == AUTOHIDE_HIDDEN
                   || window->autohide_state == AUTOHIDE_POPUP))
     {
+      /* autohide timeout is already running, so let's wait with hiding the panel */
+      if (window->autohide_timeout_id != 0)
+        return;
+
       /* window is invisible */
       window->alloc.x = window->alloc.y = -9999;
 
@@ -1484,12 +1492,20 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
           window->popdown_progress = window->alloc.width;
           window->floating = FALSE;
         }
+      else
+        window->floating = TRUE;
 G_GNUC_END_IGNORE_DEPRECATIONS
 
-      /* make the panel visible without animation */
+      /* make the panel invisible without animation */
       if (window->floating
           || window->popdown_speed == 0)
-        gtk_window_move (GTK_WINDOW (window), window->alloc.x, window->alloc.y);
+        {
+          /* cancel any pending animations */
+          if (window->autohide_ease_out_id != 0)
+            g_source_remove (window->autohide_ease_out_id);
+
+          gtk_window_move (GTK_WINDOW (window), window->alloc.x, window->alloc.y);
+        }
     }
   else
     {

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


More information about the Xfce4-commits mailing list