Re: [AD] new GUI focus selection algorithm

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> I expected to be able to cycle through them with KEY_UP/KEY_DOWN. But
> instead, the middle button is ignored.

Yes, I also remarked weird things with the focus algorithm but never got 
around to fixing it. Glad to see you are tackling the problem!

> So, I looked into the source, and the current GUI just compares the
> upper left corner of objects, and then chooses dialogs whose upper left
> corners are in the same direction, where the arbitrarily chosen distance
> formula used is x_distance + 8 * y_distance for horizontal and
> y_distance + 8 * x_distance for vertical movement.

Pretty interesting ;-) Where can this 8 magical number come from?

> Now, to me, the obvious way to select the next focused dialog is to use
> the dialog with which the current one would collide if it moved into the
> direction for which the cursor key is pressed. The attached patch
> changes the behavior to do this.

That seems sensible to me.

> It solves my example above, and there should also be no regression in
> any other cases. Only if previously another dialog was "jumped over",
> this now doesn't happen anymore.
>
> I also removed an unneeded parameter from move_focus, and excluded
> hidden and disabled objects from the sorting, since offer_focus won't
> give focus to them anyway.

Sorry, but I'm already a bit behind the normal release schedule so I can't 
review it for 4.1.12 WIP. It is therefore queued until the tree reopens.

-- 
Eric Botcazou




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/