Add ui::Manager::processFocusMovementMessage() function

This commit is contained in:
David Capello 2016-11-18 14:22:14 -03:00
parent 6746049e60
commit 0703bf159c
2 changed files with 6 additions and 6 deletions

View File

@ -75,7 +75,6 @@ static Widget* capture_widget; // The widget that captures the mouse
static bool first_time = true; // true when we don't enter in poll yet
/* keyboard focus movement stuff */
static bool move_focus(Manager* manager, Message* msg);
static int count_widgets_accept_focus(Widget* widget);
static bool childs_accept_focus(Widget* widget, bool first);
static Widget* next_widget(Widget* widget);
@ -1113,7 +1112,7 @@ bool Manager::onProcessMessage(Message* msg)
// Check the focus movement for foreground (non-desktop) windows.
if (win && win->isForeground()) {
if (msg->type() == kKeyDownMessage)
move_focus(this, msg);
processFocusMovementMessage(msg);
return true;
}
else
@ -1512,7 +1511,7 @@ void Manager::broadcastKeyMsg(Message* msg)
Focus Movement
***********************************************************************/
static bool move_focus(Manager* manager, Message* msg)
bool Manager::processFocusMovementMessage(Message* msg)
{
int (*cmp)(Widget*, int, int) = NULL;
Widget* focus = NULL;
@ -1525,8 +1524,8 @@ static bool move_focus(Manager* manager, Message* msg)
if (focus_widget) {
window = focus_widget->window();
}
else if (!manager->children().empty()) {
window = manager->getTopWindow();
else if (!this->children().empty()) {
window = this->getTopWindow();
}
if (!window)
@ -1612,7 +1611,7 @@ static bool move_focus(Manager* manager, Message* msg)
}
if ((focus) && (focus != focus_widget))
Manager::getDefault()->setFocus(focus);
setFocus(focus);
}
return ret;

View File

@ -84,6 +84,7 @@ namespace ui {
LayoutIO* getLayoutIO();
bool isFocusMovementKey(Message* msg);
bool processFocusMovementMessage(Message* msg);
// Returns the invalid region in the screen to being updated with
// PaintMessages. This region is cleared when each widget receives