From 7d44c666ff59c437d1e3b7111dc51460f5e33c95 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 22 Dec 2010 09:36:23 -0500 Subject: [PATCH] altTab: use 'selected' pseudo-style for selected item This makes it consistent with other parts of the UI and will let the a11y code use the rule "has_style_pseudo_class('selected') => ATK_STATE_SELECTED" https://bugzilla.gnome.org/show_bug.cgi?id=637830 --- data/theme/gnome-shell.css | 21 +++++++++------------ js/ui/altTab.js | 16 ++++++++++------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 72c672da4..c5a97db4a 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -993,6 +993,15 @@ StTooltip StLabel { border-radius: 8px; } +.switcher-list .item-box:outlined { + padding: 6px; + border: 2px solid rgba(85,85,85,1.0); +} + +.switcher-list .item-box:selected { + background: rgba(255,255,255,0.33); +} + .switcher-list .thumbnail-box { padding: 2px; spacing: 4px; @@ -1002,18 +1011,6 @@ StTooltip StLabel { width: 256px; } -.switcher-list .outlined-item-box { - padding: 6px; - border: 2px solid rgba(85,85,85,1.0); - border-radius: 8px; -} - -.switcher-list .selected-item-box { - padding: 8px; - border-radius: 8px; - background: rgba(255,255,255,0.33); -} - .switcher-list .separator { width: 1px; background: rgba(255,255,255,0.33); diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 824c1b097..ca2b902be 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -604,16 +604,18 @@ SwitcherList.prototype = { }, highlight: function(index, justOutline) { - if (this._highlighted != -1) - this._items[this._highlighted].style_class = 'item-box'; + if (this._highlighted != -1) { + this._items[this._highlighted].remove_style_pseudo_class('outlined'); + this._items[this._highlighted].remove_style_pseudo_class('selected'); + } this._highlighted = index; if (this._highlighted != -1) { if (justOutline) - this._items[this._highlighted].style_class = 'outlined-item-box'; + this._items[this._highlighted].add_style_pseudo_class('outlined'); else - this._items[this._highlighted].style_class = 'selected-item-box'; + this._items[this._highlighted].add_style_pseudo_class('selected'); } let monitor = global.get_primary_monitor(); @@ -859,9 +861,11 @@ AppSwitcher.prototype = { while(this._items.length > 1 && this._items[j].style_class != 'item-box') { j++; } - let iconPadding = this._items[j].get_theme_node().get_horizontal_padding(); + let themeNode = this._items[j].get_theme_node(); + let iconPadding = themeNode.get_horizontal_padding(); + let iconBorder = themeNode.get_border_width(St.Side.LEFT) + themeNode.get_border_width(St.Side.RIGHT); let [iconMinHeight, iconNaturalHeight] = this.icons[j].label.get_preferred_height(-1); - let iconSpacing = iconNaturalHeight + iconPadding; + let iconSpacing = iconNaturalHeight + iconPadding + iconBorder; let totalSpacing = this._list.spacing * (this._items.length - 1); if (this._separator) totalSpacing += this._separator.width + this._list.spacing;