From 26d3b1929e2cd9dcedf829a2224857a533040729 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 18 Jul 2012 12:19:55 +0200 Subject: [PATCH] St: don't attempt to give focus to non reactive actors Non reactive actors don't expect to be interacted with, and thus should not get keyboard focus. https://bugzilla.gnome.org/show_bug.cgi?id=619955 --- js/ui/networkAgent.js | 1 - js/ui/popupMenu.js | 7 ++----- src/st/st-bin.c | 3 ++- src/st/st-entry.c | 3 ++- src/st/st-widget.c | 3 ++- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/js/ui/networkAgent.js b/js/ui/networkAgent.js index 1c29b98f3..0615a908b 100644 --- a/js/ui/networkAgent.js +++ b/js/ui/networkAgent.js @@ -165,7 +165,6 @@ const NetworkSecretDialog = new Lang.Class({ } this._okButton.button.reactive = valid; - this._okButton.button.can_focus = valid; }, _onOk: function() { diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 54447caaa..beb26cde4 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -134,7 +134,6 @@ const PopupBaseMenuItem = new Lang.Class({ this.sensitive = sensitive; this.actor.reactive = sensitive; - this.actor.can_focus = sensitive; if (sensitive) this.actor.remove_style_pseudo_class('insensitive'); @@ -773,12 +772,10 @@ const PopupSwitchMenuItem = new Lang.Class({ this._statusLabel.text = text; this._statusBin.child = this._statusLabel; this.actor.reactive = false; - this.actor.can_focus = false; this.actor.accessible_role = Atk.Role.MENU_ITEM; } else { this._statusBin.child = this._switch.actor; this.actor.reactive = true; - this.actor.can_focus = true; this.actor.accessible_role = Atk.Role.CHECK_MENU_ITEM; } this.checkAccessibleState(); @@ -1891,7 +1888,7 @@ const RemoteMenu = new Lang.Class({ })); } - item.actor.reactive = item.actor.can_focus = action.enabled; + item.actor.reactive = action.enabled; if (action.enabled) item.actor.remove_style_pseudo_class('insensitive'); else @@ -2027,7 +2024,7 @@ const RemoteMenu = new Lang.Class({ if (action.items.length) { for (let i = 0; i < action.items.length; i++) { let item = action.items[i]; - item.actor.reactive = item.actor.can_focus = action.enabled; + item.actor.reactive = action.enabled; if (action.enabled) item.actor.remove_style_pseudo_class('insensitive'); diff --git a/src/st/st-bin.c b/src/st/st-bin.c index 71c7c3a5c..29cdccb2a 100644 --- a/src/st/st-bin.c +++ b/src/st/st-bin.c @@ -195,7 +195,8 @@ st_bin_navigate_focus (StWidget *widget, StBinPrivate *priv = ST_BIN (widget)->priv; ClutterActor *bin_actor = CLUTTER_ACTOR (widget); - if (st_widget_get_can_focus (widget)) + if (clutter_actor_get_reactive (bin_actor) && + st_widget_get_can_focus (widget)) { if (from && clutter_actor_contains (bin_actor, from)) return FALSE; diff --git a/src/st/st-entry.c b/src/st/st-entry.c index a035cd264..32a1becb3 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -285,7 +285,8 @@ st_entry_navigate_focus (StWidget *widget, if (from == priv->entry) return FALSE; - else if (st_widget_get_can_focus (widget)) + else if (clutter_actor_get_reactive (CLUTTER_ACTOR (widget)) && + st_widget_get_can_focus (widget)) { clutter_actor_grab_key_focus (priv->entry); return TRUE; diff --git a/src/st/st-widget.c b/src/st/st-widget.c index f1962886d..6d6539378 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -1880,7 +1880,8 @@ st_widget_real_navigate_focus (StWidget *widget, while (focus_child && clutter_actor_get_parent (focus_child) != widget_actor) focus_child = clutter_actor_get_parent (focus_child); - if (widget->priv->can_focus) + if (clutter_actor_get_reactive (widget_actor) && + widget->priv->can_focus) { if (!focus_child) {