--- gnome-panel-2.28.0-orig/applets/wncklet/window-list.c 2009-08-11 14:59:46.000000000 +0000 +++ gnome-panel-2.28.0/applets/wncklet/window-list.c 2009-12-30 14:46:13.000000000 +0000 @@ -130,7 +130,7 @@ return; tasklist->orientation = new_orient; - + wnck_tasklist_set_orientation (tasklist->tasklist, new_orient); tasklist_update (tasklist); } @@ -518,7 +518,8 @@ } tasklist->tasklist = wnck_tasklist_new (NULL); - + wnck_tasklist_set_orientation (tasklist->tasklist, tasklist->orientation); + wnck_tasklist_set_icon_loader (WNCK_TASKLIST (tasklist->tasklist), icon_loader_func, tasklist, --- libwnck-2.28.0-orig/libwnck/tasklist.c 2009-09-08 01:28:12.000000000 +0000 +++ libwnck-2.28.0/libwnck/tasklist.c 2009-12-30 16:46:36.000000000 +0000 @@ -234,6 +234,8 @@ GdkPixmap *background; guint drag_start_time; + + GtkOrientation orientation; }; static GType wnck_task_get_type (void); @@ -316,6 +318,7 @@ int max_width, int max_height, int n_buttons, + GtkOrientation orientation, int *n_cols_out, int *n_rows_out); @@ -972,6 +975,20 @@ } /** + * wnck_tasklist_set_orientation: + * @tasklist: a #WnckTasklist. + * @orient: a GtkOrientation. + * + * Set the orientation of the @taskluist. The main use of this function is + * proper integration of #WnckTasklist in vertical panels. + */ + +void wnck_tasklist_set_orientation(WnckTasklist *tasklist, GtkOrientation orient) +{ + tasklist->priv->orientation = orient; +} + +/** * wnck_tasklist_set_switch_workspace_on_unminimize: * @tasklist: a #WnckTasklist. * @switch_workspace_on_unminimize: whether to activate the #WnckWorkspace a @@ -1143,29 +1160,38 @@ int max_width, int max_height, int n_buttons, + GtkOrientation orientation, int *n_cols_out, int *n_rows_out) { int n_cols, n_rows; - /* How many rows fit in the allocation */ - n_rows = allocation->height / max_height; - - /* Don't have more rows than buttons */ - n_rows = MIN (n_rows, n_buttons); - - /* At least one row */ - n_rows = MAX (n_rows, 1); - - /* We want to use as many rows as possible to limit the width */ - n_cols = (n_buttons + n_rows - 1) / n_rows; - - /* At least one column */ - n_cols = MAX (n_cols, 1); + if (orientation == GTK_ORIENTATION_HORIZONTAL) { + /* How many rows fit in the allocation */ + n_rows = allocation->height / max_height; + + /* Don't have more rows than buttons */ + n_rows = MIN (n_rows, n_buttons); + + /* At least one row */ + n_rows = MAX (n_rows, 1); + + /* We want to use as many rows as possible to limit the width */ + n_cols = (n_buttons + n_rows - 1) / n_rows; + + /* At least one column */ + n_cols = MAX (n_cols, 1); + + } else { + n_cols = allocation->width / max_width; + n_cols = MIN(n_cols, n_buttons); + n_cols = MAX(n_cols, 1); + n_rows = (n_buttons + n_cols - 1) / n_cols; + n_rows = MAX(n_rows, 1); + } *n_cols_out = n_cols; *n_rows_out = n_rows; - return allocation->width / n_cols; } @@ -1358,19 +1384,31 @@ tasklist->priv->max_button_width, tasklist->priv->max_button_height, n_windows + n_startup_sequences, + tasklist->priv->orientation, &n_cols, &n_rows); last_n_cols = G_MAXINT; lowest_range = G_MAXINT; if (tasklist->priv->grouping != WNCK_TASKLIST_ALWAYS_GROUP) { - val = n_cols * tasklist->priv->max_button_width; - g_array_insert_val (array, array->len, val); - val = n_cols * grouping_limit; - g_array_insert_val (array, array->len, val); - - last_n_cols = n_cols; - lowest_range = val; + if (tasklist->priv->orientation == GTK_ORIENTATION_HORIZONTAL) { + val = n_cols * tasklist->priv->max_button_width; + g_array_insert_val (array, array->len, val); + val = n_cols * grouping_limit; + g_array_insert_val (array, array->len, val); + + last_n_cols = n_cols; + lowest_range = val; + } else { + val = n_rows * tasklist->priv->max_button_height; + g_array_insert_val (array, array->len, val); + val = n_rows * grouping_limit; + g_array_insert_val (array, array->len, val); + + last_n_cols = n_rows; + lowest_range = val; + + } } while (ungrouped_class_groups != NULL && @@ -1390,29 +1428,56 @@ tasklist->priv->max_button_width, tasklist->priv->max_button_height, n_startup_sequences + n_windows - n_grouped_buttons, + tasklist->priv->orientation, &n_cols, &n_rows); - if (n_cols != last_n_cols && - (tasklist->priv->grouping == WNCK_TASKLIST_AUTO_GROUP || - ungrouped_class_groups == NULL)) - { - val = n_cols * tasklist->priv->max_button_width; - if (val >= lowest_range) - { /* Overlaps old range */ - g_assert (array->len > 0); - lowest_range = n_cols * grouping_limit; - g_array_index(array, int, array->len-1) = lowest_range; - } - else - { - /* Full new range */ - g_array_insert_val (array, array->len, val); - val = n_cols * grouping_limit; - g_array_insert_val (array, array->len, val); - lowest_range = val; - } - - last_n_cols = n_cols; - } + if (tasklist->priv->orientation == GTK_ORIENTATION_HORIZONTAL) { + if (n_cols != last_n_cols && + (tasklist->priv->grouping == WNCK_TASKLIST_AUTO_GROUP || + ungrouped_class_groups == NULL)) + { + val = n_cols * tasklist->priv->max_button_width; + if (val >= lowest_range) + { /* Overlaps old range */ + g_assert (array->len > 0); + lowest_range = n_cols * grouping_limit; + g_array_index(array, int, array->len-1) = lowest_range; + } + else + { + /* Full new range */ + g_array_insert_val (array, array->len, val); + val = n_cols * grouping_limit; + g_array_insert_val (array, array->len, val); + lowest_range = val; + } + + last_n_cols = n_cols; + } + } else { + if (n_rows != last_n_cols && + (tasklist->priv->grouping == WNCK_TASKLIST_AUTO_GROUP || + ungrouped_class_groups == NULL)) + { + val = n_rows * tasklist->priv->max_button_height;; + if (val >= lowest_range) + { /* Overlaps old range */ + g_assert (array->len > 0); + lowest_range = n_rows * grouping_limit; + g_array_index(array, int, array->len-1) = lowest_range; + } + else + { + /* Full new range */ + g_array_insert_val (array, array->len, val); + val = n_rows * grouping_limit; + g_array_insert_val (array, array->len, val); + lowest_range = val; + } + + last_n_cols = n_rows; + } + } + } g_list_free (ungrouped_class_groups); @@ -1434,8 +1499,13 @@ tasklist->priv->size_hints = (int *)g_array_free (array, FALSE); - requisition->width = tasklist->priv->size_hints[0]; - requisition->height = fake_allocation.height; + if (tasklist->priv->orientation == GTK_ORIENTATION_VERTICAL) { + requisition->width = n_cols * tasklist->priv->max_button_width; + requisition->height = n_rows * tasklist->priv->max_button_height; + } else { + requisition->width = tasklist->priv->size_hints[0]; + requisition->height = fake_allocation.height; + } } /** @@ -1528,6 +1598,7 @@ tasklist->priv->max_button_width, tasklist->priv->max_button_height, n_startup_sequences + n_windows, + tasklist->priv->orientation, &n_cols, &n_rows); while (ungrouped_class_groups != NULL && ((tasklist->priv->grouping == WNCK_TASKLIST_ALWAYS_GROUP) || @@ -1577,6 +1648,7 @@ tasklist->priv->max_button_width, tasklist->priv->max_button_height, n_startup_sequences + n_windows - n_grouped_buttons, + tasklist->priv->orientation, &n_cols, &n_rows); } @@ -2125,6 +2197,7 @@ WnckTasklist *tasklist; tasklist = g_object_new (WNCK_TYPE_TASKLIST, NULL); + tasklist->priv->orientation = GTK_ORIENTATION_HORIZONTAL; return GTK_WIDGET (tasklist); } @@ -4196,7 +4269,6 @@ WnckTask *task; task = g_object_new (WNCK_TYPE_TASK, NULL); - task->type = WNCK_TASK_WINDOW; task->window = g_object_ref (window); task->class_group = g_object_ref (wnck_window_get_class_group (window)); --- libwnck-2.28.0-orig/libwnck/tasklist.h 2009-04-19 17:40:32.000000000 +0000 +++ libwnck-2.28.0/libwnck/tasklist.h 2009-12-30 17:10:20.000000000 +0000 @@ -99,6 +99,8 @@ gboolean include_all_workspaces); void wnck_tasklist_set_button_relief (WnckTasklist *tasklist, GtkReliefStyle relief); +void wnck_tasklist_set_orientation(WnckTasklist *tasklist, GtkOrientation orient); + #ifndef WNCK_DISABLE_DEPRECATED void wnck_tasklist_set_minimum_width (WnckTasklist *tasklist, gint size); gint wnck_tasklist_get_minimum_width (WnckTasklist *tasklist);