Fix regression in resizing logic (taskbar_distribute_size now works correctly when the taskbar is completely empty)

This commit is contained in:
o9000 2016-10-25 09:47:51 +02:00
parent ce0acdbd5b
commit 040f6479bf

View file

@ -490,7 +490,8 @@ gboolean resize_panel(void *obj)
}
// Distribute the remaining size between tasks
int task_size = total_size / MAX(num_tasks, 1);
if (num_tasks > 0) {
int task_size = total_size / num_tasks;
for (int i = 0; i < panel->num_desktops; i++) {
Taskbar *taskbar = &panel->taskbar[i];
if (!taskbar->area.on_screen)
@ -507,6 +508,18 @@ gboolean resize_panel(void *obj)
taskbar->area.height += task_size;
}
}
} else {
// No tasks => expand the first visible taskbar
for (int i = 0; i < panel->num_desktops; i++) {
Taskbar *taskbar = &panel->taskbar[i];
if (!taskbar->area.on_screen)
continue;
if (panel_horizontal)
taskbar->area.width += total_size;
else
taskbar->area.height += total_size;
}
}
for (int i = 0; i < panel->num_desktops; i++) {
Taskbar *taskbar = &panel->taskbar[i];
taskbar->area.resize_needed =