[Xfce4-commits] [xfce/xfce4-panel] 02/05: autohide: Don't animate hiding of floating panels

noreply at xfce.org noreply at xfce.org
Mon Oct 14 01:34:58 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 b8609b06851ab523f7591d1001a158a21b52ea0d
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sat Oct 12 23:42:44 2019 +0200

    autohide: Don't animate hiding of floating panels
---
 panel/panel-window.c | 45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

diff --git a/panel/panel-window.c b/panel/panel-window.c
index 52e3ddc..c71a586 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -1352,6 +1352,7 @@ panel_window_size_allocate (GtkWidget     *widget,
   gint           w, h, x, y;
   PanelBorders   borders;
   GtkWidget     *child;
+  gboolean       floating = TRUE;
 
   gtk_widget_set_allocation (widget, alloc);
   window->alloc = *alloc;
@@ -1399,16 +1400,40 @@ panel_window_size_allocate (GtkWidget     *widget,
       panel_base_window_move_resize (PANEL_BASE_WINDOW (window->autohide_window),
                                      x, y, w, h);
 
-      /* slide out the panel window in FADE_TIME
-         FIXME: Make sure floating panels don't get animated */
-      if (IS_HORIZONTAL (window))
-        fade_change_timeout = FADE_TIME / window->alloc.height;
-      else
-        fade_change_timeout = FADE_TIME / window->alloc.width;
+      /* slide out the panel window in FADE_TIME, but ignore panels that are floating, i.e. not
+         attached to a GdkScreen border (i.e. including panels which are on a monitor border, but
+         at are at the same time between two monitors) */
+      if (IS_HORIZONTAL (window)
+          && (((y + h) == gdk_screen_get_height (window->screen))
+               || (y == 0)))
+        {
+          floating = FALSE;
+        }
+      else if (!IS_HORIZONTAL (window)
+               && (((x + w) == gdk_screen_get_width (window->screen))
+                    || (x == 0)))
+        {
+          floating = FALSE;
+        }
 
-      window->autohide_fade_id = g_timeout_add (fade_change_timeout,
-                                                panel_window_autohide_slideout,
-                                                window);
+      if (floating)
+        {
+          gtk_window_move (GTK_WINDOW (window), window->alloc.x, window->alloc.y);
+        }
+      else
+        {
+          if (IS_HORIZONTAL (window))
+            fade_change_timeout = FADE_TIME / window->alloc.height;
+          else
+            fade_change_timeout = FADE_TIME / window->alloc.width;
+
+          /* FIXME: make sure the transition can be properly canceled, e.g. when
+             the autohide block mechanism of showing a menu ends, the hovering
+             cursor results in a panel that jumps back and forth */
+          window->autohide_fade_id = g_timeout_add (fade_change_timeout,
+                                                    panel_window_autohide_slideout,
+                                                    window);
+        }
     }
   else
     {
@@ -2497,6 +2522,8 @@ panel_window_autohide_slideout (gpointer data)
   gtk_window_get_position (GTK_WINDOW (window->autohide_window), &auto_x, &auto_y);
   borders = panel_base_window_get_borders (PANEL_BASE_WINDOW (window));
 
+  /* FIXME: maybe use something instead of the autohide window, because this may
+     cause issues with the autohide window being moved to -9999/-9999 */
   g_warning ("autohide window: %d/%d panel window %d/%d", auto_x, auto_y, x, y);
 
   if (IS_HORIZONTAL (window))

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


More information about the Xfce4-commits mailing list