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