Commit 69fae345 authored by Gaël Bonithon's avatar Gaël Bonithon
Browse files

tasklist: Keep dnd position when grouping/ungrouping windows

This was supposed to be fixed in 8e36c4e4, but in fact it was only fixed
in a few special cases, by side effect.

Fixes: #323
Related: !81
parent ed56fbb1
......@@ -4328,6 +4328,24 @@ xfce_tasklist_group_button_name_changed_idle (gpointer data)
static void
xfce_tasklist_group_button_keep_dnd_position (XfceTasklistChild *group_child,
XfceTasklistChild *sibling,
XfceTasklistChild *moved)
{
XfceTasklist *tasklist = group_child->tasklist;
tasklist->windows = g_list_remove (tasklist->windows, moved);
for (GList *lp = tasklist->windows; lp != NULL; lp = lp->next)
if (lp->data == sibling)
{
tasklist->windows = g_list_insert_before (tasklist->windows, lp, moved);
break;
}
}
static void
xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child)
{
......@@ -4356,12 +4374,22 @@ xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child
if (visible_counter > 1)
{
if (group_child->tasklist->sort_order == XFCE_TASKLIST_SORT_ORDER_DND
&& ! gtk_widget_get_visible (group_child->button))
xfce_tasklist_group_button_keep_dnd_position (group_child, group_child->windows->data,
group_child);
/* show the button and take the windows */
gtk_widget_show (group_child->button);
type = CHILD_TYPE_GROUP_MENU;
}
else
{
if (group_child->tasklist->sort_order == XFCE_TASKLIST_SORT_ORDER_DND
&& gtk_widget_get_visible (group_child->button))
xfce_tasklist_group_button_keep_dnd_position (group_child, group_child,
group_child->windows->data);
/* hide the button and ungroup the buttons */
gtk_widget_hide (group_child->button);
type = CHILD_TYPE_WINDOW;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment