mirror of https://github.com/GNOME/gimp.git
app: in GimpToolWidgetGroup, improve focus behavior when adding/removing widgets
When a focused widget is added to a group, make it the new focus- widget of the group, instead of unsetting its focus if another widget already has focus. When removing the focused widget from a group, set a different widget as the group's focus widget (if one exists), instead of unsetting the focus widget, so that nonempty groups always have a focus widget.
This commit is contained in:
parent
5b217b3ad4
commit
95d2c92ff2
|
@ -447,6 +447,13 @@ gimp_tool_widget_group_children_add (GimpContainer *container,
|
|||
gimp_canvas_group_add_item (canvas_group,
|
||||
gimp_tool_widget_get_item (child));
|
||||
|
||||
if (gimp_tool_widget_get_focus (child) && priv->focus_widget)
|
||||
{
|
||||
gimp_tool_widget_set_focus (priv->focus_widget, FALSE);
|
||||
|
||||
priv->focus_widget = NULL;
|
||||
}
|
||||
|
||||
if (! priv->focus_widget)
|
||||
{
|
||||
priv->focus_widget = child;
|
||||
|
@ -482,6 +489,15 @@ gimp_tool_widget_group_children_remove (GimpContainer *container,
|
|||
priv->hover_widget = NULL;
|
||||
}
|
||||
|
||||
if (! priv->focus_widget)
|
||||
{
|
||||
priv->focus_widget =
|
||||
GIMP_TOOL_WIDGET (gimp_container_get_first_child (container));
|
||||
|
||||
if (priv->focus_widget)
|
||||
gimp_tool_widget_set_focus (priv->focus_widget, TRUE);
|
||||
}
|
||||
|
||||
gimp_canvas_group_remove_item (canvas_group,
|
||||
gimp_tool_widget_get_item (child));
|
||||
|
||||
|
|
Loading…
Reference in New Issue