1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-06-28 12:27:37 +03:00

Redistribute any leftover vertical space in Selector

This commit is contained in:
Maarten ter Huurne 2014-08-16 15:37:27 +02:00
parent ffb736d80f
commit 3cce71284a

View File

@ -75,11 +75,15 @@ int Selector::exec(int startSelection) {
auto folderIcon = gmenu2x->sc.skinRes("imgs/folder.png");
// Figure out how many items we can fit in the content area.
int lineHeight = gmenu2x->font->getLineSpacing();
if (showDirectories && folderIcon) {
lineHeight = max(lineHeight, folderIcon->height() + 2);
}
unsigned int nb_elements = max(height / lineHeight, 1u);
// Redistribute any leftover space.
lineHeight = height / nb_elements;
top += (height - lineHeight * nb_elements) / 2;
bg.convertToDisplayFormat();