[gnome-shell] combo-box-menu-item: Propagate pseudo classes to the combo menu
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] combo-box-menu-item: Propagate pseudo classes to the combo menu
- Date: Tue, 15 Nov 2011 12:55:02 +0000 (UTC)
commit b88657ab837a0bb91cebf00a5298269bfdd04cde
Author: Florian MÃllner <fmuellner gnome org>
Date: Wed Oct 26 19:24:36 2011 +0200
combo-box-menu-item: Propagate pseudo classes to the combo menu
ComboBoxMenuItems use ClutterClones to reconstruct the active item
in the associated ComboMenu, so pseudo class changes due to state
changes of the ComboBoxMenuItem don't have the intended effect
(since the actual style information is taken from the associated
ComboBoxMenu item).
As a fix, propagate relevant pseudo class changes to the active
ComboBoxMenu item.
https://bugzilla.gnome.org/show_bug.cgi?id=662799
js/ui/popupMenu.js | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 0c04748..6aee9f4 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -108,14 +108,16 @@ PopupBaseMenuItem.prototype = {
this.emit('activate', event);
},
- setActive: function (active) {
+ setActive: function (active, params) {
let activeChanged = active != this.active;
+ params = Params.parse (params, { grabKeyboard: true });
if (activeChanged) {
this.active = active;
if (active) {
this.actor.add_style_pseudo_class('active');
- this.actor.grab_key_focus();
+ if (params.grabKeyboard)
+ this.actor.grab_key_focus();
} else
this.actor.remove_style_pseudo_class('active');
this.emit('active-changed', active);
@@ -1522,6 +1524,22 @@ PopupComboMenu.prototype = {
},
_onSourceActorStyleChanged: function() {
+ // PopupComboBoxMenuItem clones the active item's actors
+ // to work with arbitrary items in the menu; this means
+ // that we need to propagate some style information and
+ // enforce style updates even when the menu is closed
+ let activeItem = this._getMenuItems()[this._activeItemPos];
+ if (this.sourceActor.has_style_pseudo_class('insensitive'))
+ activeItem.actor.add_style_pseudo_class('insensitive');
+ else
+ activeItem.actor.remove_style_pseudo_class('insensitive');
+
+ // To propagate the :active style, we need to make sure that the
+ // internal state of the PopupComboMenu is updated as well, but
+ // we must not move the keyboard grab
+ activeItem.setActive(this.sourceActor.has_style_pseudo_class('active'),
+ { grabKeyboard: false });
+
_ensureStyle(this.actor);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]