St: add keyboard focus navigation support

Add StWidget:can-focus, st_widget_navigate_focus(), and
st_container_get_focus_chain(), and implement as needed to allow
keyboard navigation of widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=621671
This commit is contained in:
Dan Winship
2010-06-15 12:11:39 -04:00
parent 58001563d9
commit d2b968a7df
8 changed files with 622 additions and 13 deletions

View File

@ -162,6 +162,25 @@ shell_generic_container_pick (ClutterActor *actor,
}
}
static GList *
shell_generic_container_get_focus_chain (StContainer *container)
{
ShellGenericContainer *self = SHELL_GENERIC_CONTAINER (container);
GList *children, *focus_chain;
focus_chain = NULL;
for (children = st_container_get_children_list (container); children; children = children->next)
{
ClutterActor *child = children->data;
if (CLUTTER_ACTOR_IS_VISIBLE (child) &&
!shell_generic_container_get_skip_paint (self, child))
focus_chain = g_list_prepend (focus_chain, child);
}
return g_list_reverse (focus_chain);
}
/**
* shell_generic_container_get_n_skip_paint:
* @self: A #ShellGenericContainer
@ -231,6 +250,7 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
StContainerClass *container_class = ST_CONTAINER_CLASS (klass);
gobject_class->finalize = shell_generic_container_finalize;
@ -240,6 +260,8 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
actor_class->paint = shell_generic_container_paint;
actor_class->pick = shell_generic_container_pick;
container_class->get_focus_chain = shell_generic_container_get_focus_chain;
shell_generic_container_signals[GET_PREFERRED_WIDTH] =
g_signal_new ("get-preferred-width",
G_TYPE_FROM_CLASS (klass),