[gnome-shell] St: don't focus hidden actors
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] St: don't focus hidden actors
- Date: Mon, 10 Sep 2012 19:25:09 +0000 (UTC)
commit 09e3aed7704fdafbe649f422fed9dd00bb705a4f
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Thu Sep 6 22:12:44 2012 +0200
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
src/shell-stack.c | 11 +++++++++--
src/st/st-bin.c | 11 +++++++++--
src/st/st-entry.c | 3 ++-
src/st/st-widget.c | 27 ++++++++++++---------------
4 files changed, 32 insertions(+), 20 deletions(-)
---
diff --git a/src/shell-stack.c b/src/shell-stack.c
index 55d5d03..c75aae8 100644
--- a/src/shell-stack.c
+++ b/src/shell-stack.c
@@ -155,8 +155,15 @@ shell_stack_navigate_focus (StWidget *widget,
if (from && clutter_actor_contains (CLUTTER_ACTOR (widget), from))
return FALSE;
- clutter_actor_grab_key_focus (CLUTTER_ACTOR (widget));
- return TRUE;
+ 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));
diff --git a/src/st/st-bin.c b/src/st/st-bin.c
index 3bfa93d..a2a67bb 100644
--- a/src/st/st-bin.c
+++ b/src/st/st-bin.c
@@ -200,8 +200,15 @@ st_bin_navigate_focus (StWidget *widget,
if (from && clutter_actor_contains (bin_actor, from))
return FALSE;
- clutter_actor_grab_key_focus (bin_actor);
- return TRUE;
+ 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);
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index e4c35a2..c6b8701 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -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;
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 717268a..c867f7d 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -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));
}
@@ -1898,9 +1887,17 @@ st_widget_real_navigate_focus (StWidget *widget,
{
if (!focus_child)
{
- /* Accept focus from outside */
- clutter_actor_grab_key_focus (widget_actor);
- return TRUE;
+ 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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]