[haiku-commits] Re: r43176 - haiku/trunk/src/preferences/screen

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 4 Nov 2011 14:45:26 -0400

On Fri, Nov 4, 2011 at 4:52 AM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:

> jscipione@xxxxxxxxx wrote:
> > -                             .AddStrut(controlsBox->TopBorderOffset() -
> 1)
> > +
> .AddStrut(floor(controlsBox->TopBorderOffset() / 16) - 1)
>
> What kind of heuristic is that? The TopBorderOffset should be exactly what
> is needed here, if it somehow isn't there must be a bug to be fixed, not
> worked around this strange way.
>

Can you (or maybe Ingo since he apparently wrote the code) confirm what
TopBorderOffset is supposed to do? Right now it is difficult for me to say
if there is a bug here or not. I think that TopBorderOffset() is suppose to
return the distance from the top of the control to the top border in pixels
but I'm not 100% sure.

I have an idea of what might be going on. TopBorderOffset() returns the
height of the control divided by 2. Other than the fact that it should
maybe round to an integer value for pixels this seems correct.

However, I am wondering if because the control is a menu in this case
TopBorderOffset is dividing the height of the expanded menu by 2, i.e. the
sum of the heights of the MenuItem's, instead of calculating off of the
collapsed menu height, i.e. the height of a single MenuItem. There are 2
items in the menu so the box height would be off by 50% which is about
right.

I'll have to look into this more I guess.

John Scipione

Other related posts: