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.
(cherry picked from commit 95d2c92ff2
)
This commit is contained in:
@ -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));
|
||||
|
||||
|
Reference in New Issue
Block a user