mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 10:50:08 +00:00
Add gtk_widget_set_focus_child
With a very useful implementation, but at least now we don't get runtime warnings.
This commit is contained in:
parent
52aed5d607
commit
5f98597a0c
@ -7231,7 +7231,7 @@ gtk_widget_real_grab_focus (GtkWidget *focus_widget)
|
||||
while (widget->priv->parent)
|
||||
{
|
||||
widget = widget->priv->parent;
|
||||
gtk_container_set_focus_child (GTK_CONTAINER (widget), NULL);
|
||||
gtk_widget_set_focus_child (widget, NULL);
|
||||
if (widget == common_ancestor)
|
||||
break;
|
||||
}
|
||||
@ -7255,7 +7255,7 @@ gtk_widget_real_grab_focus (GtkWidget *focus_widget)
|
||||
widget = focus_widget;
|
||||
while (widget->priv->parent)
|
||||
{
|
||||
gtk_container_set_focus_child (GTK_CONTAINER (widget->priv->parent), widget);
|
||||
gtk_widget_set_focus_child (widget->priv->parent, widget);
|
||||
widget = widget->priv->parent;
|
||||
}
|
||||
if (GTK_IS_WINDOW (widget))
|
||||
@ -15804,3 +15804,21 @@ gtk_widget_snapshot_child (GtkWidget *widget,
|
||||
gtk_widget_snapshot (child, snapshot);
|
||||
gtk_snapshot_translate_2d (snapshot, -x, -y);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_set_focus_child (GtkWidget *widget,
|
||||
GtkWidget *child)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
if (child != NULL)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
g_return_if_fail (gtk_widget_get_parent (child) == widget);
|
||||
}
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
gtk_container_set_focus_child (GTK_CONTAINER (widget), child);
|
||||
|
||||
/* TODO: ??? */
|
||||
}
|
||||
|
@ -1258,6 +1258,9 @@ GDK_AVAILABLE_IN_3_90
|
||||
GtkWidget * gtk_widget_get_next_sibling (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GtkWidget * gtk_widget_get_prev_sibling (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
void gtk_widget_set_focus_child (GtkWidget *widget,
|
||||
GtkWidget *child);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
|
||||
|
@ -2539,7 +2539,7 @@ gtk_window_set_focus (GtkWindow *window,
|
||||
while ((parent = _gtk_widget_get_parent (widget)))
|
||||
{
|
||||
widget = parent;
|
||||
gtk_container_set_focus_child (GTK_CONTAINER (widget), NULL);
|
||||
gtk_widget_set_focus_child (widget, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user