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

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: "haiku-commits@xxxxxxxxxxxxx" <haiku-commits@xxxxxxxxxxxxx>
  • Date: Tue, 13 Aug 2013 13:21:33 -0400

On Tue, Aug 13, 2013 at 3:08 AM, Stephan Aßmus <superstippi@xxxxxx> wrote:
> The intend is good, but the change can be improved. In the check,
> "control->IsFocus()" should come first:
>
> if (control->IsFocus() && control->Window() != NULL
>         && control->Window()->IsActive()) {
>         flags |= B_FOCUSED;
> }
>
> Otherwise you make two unnecessary function calls for every control in a
> window where only one of them is the focus control.

Thanks, I have updated the order of the conditions in hrev45964

> Also, every control that uses this should implement WindowActivated() and
> invalidate itself when it is the focus control.

This is done in BControl::WindowActivated() so provided that a control
calls it's parent method it should inherit this functionality. It's
mentioned in the BeBook as well.

Other related posts: