Deskbar: Increase MenuBar width by 1px

... so that you can click it on the screen edge in vertical mode on
the right side. The BarMenuBar was 1px too narrow and didn't take up
the last pixel of its parent BarView container and therefore wouldn't
open the menu on click on the last pixel.

MenuBar width is increased by 1px in all modes but you probably won't
be able to notice the difference in other modes.

NULL comparison style fix and floorf call to prevent non-integer width
are included.

Fixes #15813

Change-Id: Ic5ebef5a63846a397a55358a111e33987538c455
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2377
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
This commit is contained in:
John Scipione 2020-03-18 14:53:48 -04:00 committed by Axel Dörfler
parent cbb517abfd
commit b5c9fb399a

View File

@ -156,16 +156,14 @@ TBarMenuBar::SmartResize(float width, float height)
} else } else
ResizeTo(width, height); ResizeTo(width, height);
width -= 1;
if (fSeparatorItem != NULL) if (fSeparatorItem != NULL)
fDeskbarMenuItem->SetContentSize(width - kSepItemWidth, height); fDeskbarMenuItem->SetContentSize(width - kSepItemWidth, height);
else { else {
int32 count = CountItems(); int32 count = CountItems();
if (fDeskbarMenuItem) if (fDeskbarMenuItem != NULL)
fDeskbarMenuItem->SetContentSize(width / count, height); fDeskbarMenuItem->SetContentSize(floorf(width / count), height);
if (fAppListMenuItem) if (fAppListMenuItem != NULL)
fAppListMenuItem->SetContentSize(width / count, height); fAppListMenuItem->SetContentSize(floorf(width / count), height);
} }
InvalidateLayout(); InvalidateLayout();