[Xfce4-commits] <xfce4-panel:andrzejr/deskbar-github> pager: fixing infinite looping error introduced in the previous commit.

Andrzej noreply at xfce.org
Mon Dec 12 11:40:39 CET 2011


Updating branch refs/heads/andrzejr/deskbar-github
         to a07a3c3762aea23fc560deb7bcbc25c83a524d29 (commit)
       from 315c5e37af56320a22fce38789cff290324f2486 (commit)

commit a07a3c3762aea23fc560deb7bcbc25c83a524d29
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Thu Nov 24 14:30:00 2011 +0900

    pager: fixing infinite looping error introduced in the previous commit.
    
    This workaround for WNCK pager layout limitations is getting ugly.
    We might be better off adding our own pager inheriting most of the functionality from WNCK.
    This might be needed in the future anyway as workspace ordering in the vertical WNCK pager is different from what we want and there is no easy workaround for this.

 plugins/pager/pager.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c
index a4f6904..5c1989f 100644
--- a/plugins/pager/pager.c
+++ b/plugins/pager/pager.c
@@ -431,6 +431,7 @@ pager_plugin_size_allocate (GtkWidget      *widget,
   XfcePanelPlugin    *panel_plugin;
   gboolean            deskbar_mode;
   GtkOrientation      orientation;
+  gint                error;
 
   plugin = XFCE_PAGER_PLUGIN (widget);
   panel_plugin = XFCE_PANEL_PLUGIN (widget);
@@ -439,9 +440,15 @@ pager_plugin_size_allocate (GtkWidget      *widget,
 
   if (plugin->miniature_view && deskbar_mode && orientation == GTK_ORIENTATION_VERTICAL)
     {
-      /* Working around limitations of the wnck applet. */
+      /* Working around limitations of the wnck applet.*/
       /* Wnck assumes that a horizontal applet is always used in a horizontal panel. */
-      allocation->height = allocation->width * plugin->aspect;
+      /* It would be better to fix the WNCK pager instead.*/
+      error = allocation->height - plugin->aspect * allocation->width;
+      /* Adding a vertical size error allowance of +/-3px to avoid infinite looping. */
+      if (error > 3 || error < -3)
+        {
+          allocation->height = allocation->width * plugin->aspect;
+        }
     }
   gtk_widget_size_allocate (plugin->pager, allocation);
 }


More information about the Xfce4-commits mailing list