[haiku-commits] Re: haiku: hrev44466 - src/kits/interface

  • From: Ryan Leavengood <leavengood@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 4 Aug 2012 09:17:05 -0400

On Sat, Aug 4, 2012 at 7:33 AM, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
>
> While this should be better, I'm not sure this is fully correct yet.
> frameWidth is based off a BRect::Width() (conditionally minus the margins),
> i.e. it is a distance between the centers of included pixels. labelWidth,
> however, is computed based on StringWidth() which, I believe, is an actual
> pixel size. That is the check (or frameWidth) is still off a full pixel. Or
> to put that in an example: The rectangle (0, 0, 9, 9) should suffice to
> contain a 10 pixels wide string, but 9 >= 10 doesn't hold.

Logically that seems to make sense, but I don't know if it will ever
happen in reality. Though if we are sure the above is correct,
changing the if condition to "frameWidth + 1 >= labelWidth" won't
hurt.

In general though it seems the menu window is sized to fit the items
it contains (naturally), and this bug was only showing up in single
item menus, because the window was sized just to fit that item. I was
always seeing a frameWidth equal to the labelWidth when the incorrect
truncation happened.

-- 
Regards,
Ryan

Other related posts: