From 04a05cf1f6f17a63c0246c8246b09818b5a35924 Mon Sep 17 00:00:00 2001 From: Janus Date: Tue, 29 Nov 2016 21:46:19 +0100 Subject: [PATCH] Diskusage: avoid glitch in "open with..." menu * Fixes #13097. --- src/apps/diskusage/PieView.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/apps/diskusage/PieView.cpp b/src/apps/diskusage/PieView.cpp index c1d67f1370..3186626697 100644 --- a/src/apps/diskusage/PieView.cpp +++ b/src/apps/diskusage/PieView.cpp @@ -100,27 +100,24 @@ AppMenuItem::~AppMenuItem() void AppMenuItem::GetContentSize(float* _width, float* _height) { + BMenuItem::GetContentSize(_width, _height); if (_width) - *_width = fIcon->Bounds().Width() - + be_plain_font->StringWidth(Label()); - - if (_height) { - struct font_height fh; - be_plain_font->GetHeight(&fh); - float fontHeight = ceilf(fh.ascent) + ceilf(fh.descent) - + ceilf(fh.leading); - *_height = max_c(fontHeight, fIcon->Bounds().Height()); - } + *_width += fIcon->Bounds().Width(); + if (_height) + *_height = max_c(*_height, fIcon->Bounds().Height()); } void AppMenuItem::DrawContent() { + float yOffset, height; + GetContentSize(NULL, &height); + yOffset = (height - fIcon->Bounds().Height()) / 2; Menu()->SetDrawingMode(B_OP_OVER); - Menu()->MovePenBy(0.0, -1.0); + Menu()->MovePenBy(0.0, yOffset); Menu()->DrawBitmap(fIcon); - Menu()->MovePenBy(fIcon->Bounds().Width() + kSmallHMargin, 0.0); + Menu()->MovePenBy(fIcon->Bounds().Width() + kSmallHMargin, -yOffset); BMenuItem::DrawContent(); }