Nux

Code review comment for lp://qastaging/~azzar1/nux/please-dont-focus-me-on-mouse-down

Revision history for this message
Jay Taoko (jaytaoko) wrote :

There is no need to have Area::AcceptKeyNavFocusOnMouseDown use GetInputEventSensitivity().
Area::AcceptKeyNavFocus() uses GetInputEventSensitivity() already.

I propose the following

class InputArea
{

  virtual bool AcceptKeyNavFocusOnMouseDown();
  void SetAcceptKeyNavFocusOnMouseDown(bool accept);

  bool accept_key_nav_focus_on_mouse_down_;
}

InputArea::InputArea()
{
  accept_key_nav_focus_on_mouse_down_ = true;
}

bool InputArea::AcceptKeyNavFocusOnMouseDown()
{
  return accept_key_nav_focus_on_mouse_down_;
}

void InputArea::SetAcceptKeyNavFocusOnMouseDown(bool accept)
{
  accept_key_nav_focus_on_mouse_down_ = accept;
}

BaseWindow::BaseWindow(...)
{

  SetAcceptKeyNavFocusOnMouseDown(false);

}

That way we can also get other Views to not get the focus on mouse down events if there is a need for it. Not just BaseWindows. Let me know if this still works with your branch.

There is a similar problem with InputArea::AcceptKeyNavFocus(). I will re-factor it to work like SetAcceptKeyNavFocusOnMouseDown.

review: Needs Fixing

« Back to merge proposal