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

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit 3af37ad21eead0c26e3a9813aa2f0ff4e9bd7dce
Author: Olivier Fourdan <four...@xfce.org>
Date:   Sun Jan 25 22:29:51 2015 +0100

    Use actual client count to compute tabwin size
    
    And not the total number of clients.
    
    Signed-off-by: Olivier Fourdan <four...@xfce.org>
---
 src/tabwin.c |   14 ++++++++------
 src/tabwin.h |    1 +
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/tabwin.c b/src/tabwin.c
index a515fb2..9d9fb1d 100644
--- a/src/tabwin.c
+++ b/src/tabwin.c
@@ -502,12 +502,13 @@ createWindowlist (ScreenInfo *screen_info, TabwinWidget 
*tabwin_widget)
     Tabwin *tabwin;
 
     TRACE ("entering createWindowlist");
-    g_return_val_if_fail (screen_info->client_count > 0, NULL);
+    g_return_val_if_fail (tabwin_widget != NULL, NULL);
+    tabwin = tabwin_widget->tabwin;
+    g_return_val_if_fail (tabwin->client_count > 0, NULL);
 
     packpos = 0;
     c = NULL;
     selected = NULL;
-    tabwin = tabwin_widget->tabwin;
     tabwin_widget->widgets = NULL;
     size_request = tabwin->icon_size + tabwin->label_height + 2 * 
WIN_ICON_BORDER;
 
@@ -697,9 +698,9 @@ computeTabwinData (ScreenInfo *screen_info, TabwinWidget 
*tabwin_widget)
 
     TRACE ("entering computeTabwinData");
     g_return_if_fail (GTK_IS_WIDGET(tabwin_widget));
-    g_return_if_fail (screen_info->client_count > 0);
-
     tabwin = tabwin_widget->tabwin;
+    g_return_if_fail (tabwin->client_count > 0);
+
     tabwin->monitor_width = getMinMonitorWidth (screen_info);
     tabwin->monitor_height = getMinMonitorHeight (screen_info);
     tabwin->label_height = 30;
@@ -727,7 +728,7 @@ computeTabwinData (ScreenInfo *screen_info, TabwinWidget 
*tabwin_widget)
         }
         size_request = tabwin->icon_size + tabwin->label_height + 2 * 
WIN_ICON_BORDER;
         tabwin->grid_cols = (tabwin->monitor_width / (size_request)) * 0.75;
-        tabwin->grid_rows = screen_info->client_count / tabwin->grid_cols;
+        tabwin->grid_rows = tabwin->client_count / tabwin->grid_cols;
 
         /* If we run out of space, halve the icon size to make more room. */
         while ((size_request) * tabwin->grid_rows > tabwin->monitor_height - 
tabwin->label_height)
@@ -749,7 +750,7 @@ computeTabwinData (ScreenInfo *screen_info, TabwinWidget 
*tabwin_widget)
 
             /* Recalculate with new icon size */
             tabwin->grid_cols = (tabwin->monitor_width / (size_request)) * 
0.75;
-            tabwin->grid_rows = screen_info->client_count / tabwin->grid_cols 
+ 1;
+            tabwin->grid_rows = tabwin->client_count / tabwin->grid_cols + 1;
 
             /* Shrinking the icon too much makes it hard to see */
             if (tabwin->icon_size < 8)
@@ -937,6 +938,7 @@ tabwinCreate (GList **client_list, GList *selected, 
gboolean display_workspace)
     screen_info = c->screen_info;
     tabwin->display_workspace = display_workspace;
     tabwin->client_list = client_list;
+    tabwin->client_count = g_list_length (*client_list);
     tabwin->selected = selected;
     tabwin->tabwin_list = NULL;
     tabwin->icon_list = NULL;
diff --git a/src/tabwin.h b/src/tabwin.h
index 7017810..e9d138c 100644
--- a/src/tabwin.h
+++ b/src/tabwin.h
@@ -50,6 +50,7 @@ struct _Tabwin
     GList *selected;
     gint monitor_width;
     gint monitor_height;
+    gint client_count;
     gint grid_cols;
     gint grid_rows;
     gint icon_size;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to