forked from AuroraMiddleware/gtk
Simplify the move_focus api
No need to pass the array in from the outside.
This commit is contained in:
parent
029ec38e63
commit
2738926dcb
@ -5459,17 +5459,8 @@ gtk_widget_real_focus (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
GPtrArray *focus_order = g_ptr_array_new ();
|
||||
gboolean ret = FALSE;
|
||||
|
||||
/* Try focusing any of the child widgets, depending on the given @direction */
|
||||
|
||||
gtk_widget_focus_sort (widget, direction, focus_order);
|
||||
ret = gtk_widget_focus_move (widget, direction, focus_order);
|
||||
|
||||
g_ptr_array_unref (focus_order);
|
||||
|
||||
if (ret)
|
||||
/* Try focusing any of the child widgets, depending on the given direction */
|
||||
if (gtk_widget_focus_move (widget, direction))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -450,13 +450,17 @@ gtk_widget_focus_sort (GtkWidget *widget,
|
||||
|
||||
gboolean
|
||||
gtk_widget_focus_move (GtkWidget *widget,
|
||||
GtkDirectionType direction,
|
||||
GPtrArray *focus_order)
|
||||
GtkDirectionType direction)
|
||||
{
|
||||
GPtrArray *focus_order;
|
||||
GtkWidget *focus_child = gtk_widget_get_focus_child (widget);
|
||||
int i;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
for (i = 0; i < focus_order->len; i ++)
|
||||
focus_order = g_ptr_array_new ();
|
||||
gtk_widget_focus_sort (widget, direction, focus_order);
|
||||
|
||||
for (i = 0; i < focus_order->len && !ret; i++)
|
||||
{
|
||||
GtkWidget *child = g_ptr_array_index (focus_order, i);
|
||||
|
||||
@ -465,18 +469,17 @@ gtk_widget_focus_move (GtkWidget *widget,
|
||||
if (focus_child == child)
|
||||
{
|
||||
focus_child = NULL;
|
||||
|
||||
if (gtk_widget_child_focus (child, direction))
|
||||
return TRUE;
|
||||
ret = gtk_widget_child_focus (child, direction);
|
||||
}
|
||||
}
|
||||
else if (_gtk_widget_is_drawable (child) &&
|
||||
gtk_widget_is_ancestor (child, widget))
|
||||
{
|
||||
if (gtk_widget_child_focus (child, direction))
|
||||
return TRUE;
|
||||
ret = gtk_widget_child_focus (child, direction);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
g_ptr_array_unref (focus_order);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -317,8 +317,7 @@ void gtk_widget_focus_sort (GtkWidget *wi
|
||||
GtkDirectionType direction,
|
||||
GPtrArray *focus_order);
|
||||
gboolean gtk_widget_focus_move (GtkWidget *widget,
|
||||
GtkDirectionType direction,
|
||||
GPtrArray *focus_order);
|
||||
GtkDirectionType direction);
|
||||
void gtk_widget_get_surface_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user