[gnome-shell/gnome-3-10] switcherPopup: Fix spacing calculation for empty lists
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-10] switcherPopup: Fix spacing calculation for empty lists
- Date: Wed, 22 Jan 2014 18:59:55 +0000 (UTC)
commit 1118cf1810f08b9bc0e7a767230ec08de0cb6adb
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jan 17 09:54:14 2014 -0500
switcherPopup: Fix spacing calculation for empty lists
Without special-casing, our current spacing calculation results in
negative size requests for empty lists, which will trigger a Clutter
assert later.
While the list is never supposed to be empty, bugs happen; crashing
users' systems is the least graceful way of handling this, so don't
do it.
https://bugzilla.gnome.org/show_bug.cgi?id=722434
js/ui/switcherPopup.js | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index e6036b0..b06be61 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -509,7 +509,7 @@ const SwitcherList = new Lang.Class({
_getPreferredWidth: function (actor, forHeight, alloc) {
let [maxChildMin, maxChildNat] = this._maxChildWidth(forHeight);
- let totalSpacing = this._list.spacing * (this._items.length - 1);
+ let totalSpacing = Math.max(this._list.spacing * (this._items.length - 1), 0);
alloc.min_size = this._items.length * maxChildMin + totalSpacing;
alloc.natural_size = alloc.min_size;
this._minSize = alloc.min_size;
@@ -539,7 +539,7 @@ const SwitcherList = new Lang.Class({
let childHeight = box.y2 - box.y1;
let [maxChildMin, maxChildNat] = this._maxChildWidth(childHeight);
- let totalSpacing = this._list.spacing * (this._items.length - 1);
+ let totalSpacing = Math.max(this._list.spacing * (this._items.length - 1), 0);
let childWidth = Math.floor(Math.max(0, box.x2 - box.x1 - totalSpacing) / this._items.length);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]