St: don't focus hidden actors
If an actors is not mapped (visible and all parents visible), then don't allow navigating focus to it. This fixes a regression in the keyboard navigation of the panel with invisibile items. https://bugzilla.gnome.org/show_bug.cgi?id=683529
This commit is contained in:
parent
452ac297ab
commit
09e3aed770
@ -155,9 +155,16 @@ shell_stack_navigate_focus (StWidget *widget,
|
||||
if (from && clutter_actor_contains (CLUTTER_ACTOR (widget), from))
|
||||
return FALSE;
|
||||
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR (widget)))
|
||||
{
|
||||
clutter_actor_grab_key_focus (CLUTTER_ACTOR (widget));
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
top_actor = clutter_actor_get_last_child (CLUTTER_ACTOR (widget));
|
||||
if (ST_IS_WIDGET (top_actor))
|
||||
|
@ -200,9 +200,16 @@ st_bin_navigate_focus (StWidget *widget,
|
||||
if (from && clutter_actor_contains (bin_actor, from))
|
||||
return FALSE;
|
||||
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (bin_actor))
|
||||
{
|
||||
clutter_actor_grab_key_focus (bin_actor);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (priv->child && ST_IS_WIDGET (priv->child))
|
||||
return st_widget_navigate_focus (ST_WIDGET (priv->child), from, direction, FALSE);
|
||||
else
|
||||
|
@ -284,7 +284,8 @@ st_entry_navigate_focus (StWidget *widget,
|
||||
|
||||
if (from == priv->entry)
|
||||
return FALSE;
|
||||
else if (st_widget_get_can_focus (widget))
|
||||
else if (st_widget_get_can_focus (widget) &&
|
||||
CLUTTER_ACTOR_IS_MAPPED (priv->entry))
|
||||
{
|
||||
clutter_actor_grab_key_focus (priv->entry);
|
||||
return TRUE;
|
||||
|
@ -763,18 +763,7 @@ st_widget_get_paint_volume (ClutterActor *self,
|
||||
static GList *
|
||||
st_widget_real_get_focus_chain (StWidget *widget)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
GList *focus_chain = NULL;
|
||||
|
||||
clutter_actor_iter_init (&iter, CLUTTER_ACTOR (widget));
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (child))
|
||||
focus_chain = g_list_prepend (focus_chain, child);
|
||||
}
|
||||
|
||||
return g_list_reverse (focus_chain);
|
||||
return clutter_actor_get_children (CLUTTER_ACTOR (widget));
|
||||
}
|
||||
|
||||
|
||||
@ -1897,11 +1886,19 @@ st_widget_real_navigate_focus (StWidget *widget,
|
||||
if (widget->priv->can_focus)
|
||||
{
|
||||
if (!focus_child)
|
||||
{
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (widget_actor))
|
||||
{
|
||||
/* Accept focus from outside */
|
||||
clutter_actor_grab_key_focus (widget_actor);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Refuse to set focus on hidden actors */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Yield focus from within: since @widget itself is
|
||||
|
Loading…
Reference in New Issue
Block a user