applets/taskmanager: Fix layout count for multiple rows/columns
The previous calculations for the number of rows
and columns
of the task grid layout implicitly assumed that the full stripes or lines would be full, which led to incorrect sizing.
We do a small refactor to depend less on the orientation and commonalize the horizontal and vertical cases as much as possible, so the algorithm is more straightforward.
- First calculate the effective number of "stripes" (that is the multiple rows or columns in which the grid will be arranged). This depends on the user preferences but it's also limited by the applet's size and the number of tasks.
- Then calculate the other dimension of the grid, dividing the number of tasks by the effective stripes. This arranges the tasks evenly and fixes the sizing of the grid layout.
- Finally assign each dimension to
rows
orcolumns
depending on the orientation
I've tested this with the different options for a different number of maximum rows and tasks.
The icon size is now a bit broken (both in master and here after !2239 (merged)) for the multirow case, but it's unrelated. The introduced property stripeCount
might be handy for this sort of things.
BEFORE | AFTER |
---|---|