[Xfce4-commits] <xfce4-panel:andrzejr/deskbar-length-adjust> tasklist-widget: fixed bug introduced in the previous commit.
Andrzej
noreply at xfce.org
Mon Dec 19 18:18:02 CET 2011
Updating branch refs/heads/andrzejr/deskbar-length-adjust
to ef2cb2d7b5e5d3da18574387e2612ede2df67a72 (commit)
from de7a3335a5c4355a14994386c49ec9a44b62b3ed (commit)
commit ef2cb2d7b5e5d3da18574387e2612ede2df67a72
Author: Andrzej <ndrwrdck at gmail.com>
Date: Tue Dec 20 01:59:39 2011 +0900
tasklist-widget: fixed bug introduced in the previous commit.
Previously the child->type's were not always cleared when the if clause was false.
Changed alloc (GtkAllocation*) into length (gint).
Sorry for the unrelated change in a single commit, it should be harmless, though.
plugins/tasklist/tasklist-widget.c | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 8172d01..e2d3a43 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -811,7 +811,7 @@ xfce_tasklist_size_sort_window (gconstpointer a,
static void
xfce_tasklist_size_layout (XfceTasklist *tasklist,
- GtkAllocation *alloc,
+ gint length,
gint *n_rows,
gint *n_cols,
gint *arrow_position)
@@ -840,13 +840,22 @@ xfce_tasklist_size_layout (XfceTasklist *tasklist,
cols++;
if (xfce_tasklist_deskbar (tasklist) || !tasklist->show_labels)
- min_button_length = alloc->height / tasklist->nrows;
+ min_button_length = tasklist->size / tasklist->nrows;
else
min_button_length = tasklist->min_button_length;
*arrow_position = -1; /* not visible */
- if (min_button_length * cols <= alloc->width)
+ /* unset overflow items, we decide about that again
+ * later */
+ for (li = tasklist->windows; li != NULL; li = li->next)
+ {
+ child = li->data;
+ if (child->type == CHILD_TYPE_OVERFLOW_MENU)
+ child->type = CHILD_TYPE_WINDOW;
+ }
+
+ if (min_button_length * cols <= length)
{
/* all the windows seem to fit */
*n_rows = rows;
@@ -861,14 +870,8 @@ xfce_tasklist_size_layout (XfceTasklist *tasklist,
{
child = li->data;
if (GTK_WIDGET_VISIBLE (child->button))
- {
- windows_scored = g_slist_insert_sorted (windows_scored, child,
- xfce_tasklist_size_sort_window);
- /* unset overflow items, we decide about that again
- * later */
- if (child->type == CHILD_TYPE_OVERFLOW_MENU)
- child->type = CHILD_TYPE_WINDOW;
- }
+ windows_scored = g_slist_insert_sorted (windows_scored, child,
+ xfce_tasklist_size_sort_window);
}
if (xfce_tasklist_deskbar (tasklist) || !tasklist->show_labels)
@@ -880,12 +883,12 @@ xfce_tasklist_size_layout (XfceTasklist *tasklist,
n_buttons = tasklist->n_windows;
/* Matches the existing behavior (with a bug fix) */
- /* n_buttons_target = MIN ((alloc->width - ARROW_BUTTON_SIZE) / min_button_length * rows, *
- * (((alloc->width - ARROW_BUTTON_SIZE) / max_button_length) + 1) * rows); */
+ /* n_buttons_target = MIN ((length - ARROW_BUTTON_SIZE) / min_button_length * rows, *
+ * (((length - ARROW_BUTTON_SIZE) / max_button_length) + 1) * rows); */
/* Perhaps a better behavior (tries to display more buttons on the panel, */
/* yet still within the specified limits) */
- n_buttons_target = (alloc->width - ARROW_BUTTON_SIZE) / min_button_length * rows;
+ n_buttons_target = (length - ARROW_BUTTON_SIZE) / min_button_length * rows;
#if 0
if (tasklist->grouping == XFCE_TASKLIST_GROUPING_AUTO)
@@ -915,7 +918,7 @@ xfce_tasklist_size_layout (XfceTasklist *tasklist,
/* Try to position the arrow widget at the end of the allocation area *
* if that's impossible (because buttons cannot be expanded enough) *
* position it just after the buttons. */
- *arrow_position = MIN (alloc->width - ARROW_BUTTON_SIZE,
+ *arrow_position = MIN (length - ARROW_BUTTON_SIZE,
n_buttons_target * max_button_length / rows);
}
@@ -966,7 +969,7 @@ xfce_tasklist_size_allocate (GtkWidget *widget,
/* useless but hides compiler warning */
w = h = x = y = rows = cols = 0;
- xfce_tasklist_size_layout (tasklist, &area, &rows, &cols, &arrow_position);
+ xfce_tasklist_size_layout (tasklist, area.width, &rows, &cols, &arrow_position);
/* allocate the arrow button for the overflow menu */
child_alloc.width = ARROW_BUTTON_SIZE;
More information about the Xfce4-commits
mailing list