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

View File

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