switcherPopup: Remove separator support
Since the alt-tab switcher stopped using separators, the functionality is unused, remove it. https://bugzilla.gnome.org/show_bug.cgi?id=661156
This commit is contained in:
parent
b50702dd52
commit
f9d9caf417
@ -305,7 +305,7 @@ const SwitcherList = new Lang.Class({
|
|||||||
this.actor.connect('allocate', Lang.bind(this, this._allocateTop));
|
this.actor.connect('allocate', Lang.bind(this, this._allocateTop));
|
||||||
|
|
||||||
// Here we use a GenericContainer so that we can force all the
|
// Here we use a GenericContainer so that we can force all the
|
||||||
// children except the separator to have the same width.
|
// children to have the same width.
|
||||||
this._list = new Shell.GenericContainer({ style_class: 'switcher-list-item-container' });
|
this._list = new Shell.GenericContainer({ style_class: 'switcher-list-item-container' });
|
||||||
this._list.spacing = 0;
|
this._list.spacing = 0;
|
||||||
this._list.connect('style-changed', Lang.bind(this, function() {
|
this._list.connect('style-changed', Lang.bind(this, function() {
|
||||||
@ -340,7 +340,6 @@ const SwitcherList = new Lang.Class({
|
|||||||
|
|
||||||
this._items = [];
|
this._items = [];
|
||||||
this._highlighted = -1;
|
this._highlighted = -1;
|
||||||
this._separator = null;
|
|
||||||
this._squareItems = squareItems;
|
this._squareItems = squareItems;
|
||||||
this._minSize = 0;
|
this._minSize = 0;
|
||||||
this._scrollableRight = true;
|
this._scrollableRight = true;
|
||||||
@ -403,12 +402,6 @@ const SwitcherList = new Lang.Class({
|
|||||||
this._itemEntered(index);
|
this._itemEntered(index);
|
||||||
},
|
},
|
||||||
|
|
||||||
addSeparator: function () {
|
|
||||||
let box = new St.Bin({ style_class: 'separator' });
|
|
||||||
this._separator = box;
|
|
||||||
this._list.add_actor(box);
|
|
||||||
},
|
|
||||||
|
|
||||||
highlight: function(index, justOutline) {
|
highlight: function(index, justOutline) {
|
||||||
if (this._highlighted != -1) {
|
if (this._highlighted != -1) {
|
||||||
this._items[this._highlighted].remove_style_pseudo_class('outlined');
|
this._items[this._highlighted].remove_style_pseudo_class('outlined');
|
||||||
@ -516,14 +509,8 @@ const SwitcherList = new Lang.Class({
|
|||||||
_getPreferredWidth: function (actor, forHeight, alloc) {
|
_getPreferredWidth: function (actor, forHeight, alloc) {
|
||||||
let [maxChildMin, maxChildNat] = this._maxChildWidth(forHeight);
|
let [maxChildMin, maxChildNat] = this._maxChildWidth(forHeight);
|
||||||
|
|
||||||
let separatorWidth = 0;
|
|
||||||
if (this._separator) {
|
|
||||||
let [sepMin, sepNat] = this._separator.get_preferred_width(forHeight);
|
|
||||||
separatorWidth = sepNat + this._list.spacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
let totalSpacing = this._list.spacing * (this._items.length - 1);
|
let totalSpacing = this._list.spacing * (this._items.length - 1);
|
||||||
alloc.min_size = this._items.length * maxChildMin + separatorWidth + totalSpacing;
|
alloc.min_size = this._items.length * maxChildMin + totalSpacing;
|
||||||
alloc.natural_size = alloc.min_size;
|
alloc.natural_size = alloc.min_size;
|
||||||
this._minSize = alloc.min_size;
|
this._minSize = alloc.min_size;
|
||||||
},
|
},
|
||||||
@ -554,14 +541,7 @@ const SwitcherList = new Lang.Class({
|
|||||||
let [maxChildMin, maxChildNat] = this._maxChildWidth(childHeight);
|
let [maxChildMin, maxChildNat] = this._maxChildWidth(childHeight);
|
||||||
let totalSpacing = this._list.spacing * (this._items.length - 1);
|
let totalSpacing = this._list.spacing * (this._items.length - 1);
|
||||||
|
|
||||||
let separatorWidth = 0;
|
let childWidth = Math.floor(Math.max(0, box.x2 - box.x1 - totalSpacing) / this._items.length);
|
||||||
if (this._separator) {
|
|
||||||
let [sepMin, sepNat] = this._separator.get_preferred_width(childHeight);
|
|
||||||
separatorWidth = sepNat;
|
|
||||||
totalSpacing += this._list.spacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
let childWidth = Math.floor(Math.max(0, box.x2 - box.x1 - totalSpacing - separatorWidth) / this._items.length);
|
|
||||||
|
|
||||||
let x = 0;
|
let x = 0;
|
||||||
let children = this._list.get_children();
|
let children = this._list.get_children();
|
||||||
@ -581,14 +561,6 @@ const SwitcherList = new Lang.Class({
|
|||||||
children[i].allocate(childBox, flags);
|
children[i].allocate(childBox, flags);
|
||||||
|
|
||||||
x += this._list.spacing + childWidth;
|
x += this._list.spacing + childWidth;
|
||||||
} else if (children[i] == this._separator) {
|
|
||||||
// We want the separator to be more compact than the rest.
|
|
||||||
childBox.x1 = x;
|
|
||||||
childBox.y1 = 0;
|
|
||||||
childBox.x2 = x + separatorWidth;
|
|
||||||
childBox.y2 = childHeight;
|
|
||||||
children[i].allocate(childBox, flags);
|
|
||||||
x += this._list.spacing + separatorWidth;
|
|
||||||
} else {
|
} else {
|
||||||
// Something else, eg, AppSwitcher's arrows;
|
// Something else, eg, AppSwitcher's arrows;
|
||||||
// we don't allocate it.
|
// we don't allocate it.
|
||||||
|
Loading…
Reference in New Issue
Block a user