[gnome-shell/wip/re-search: 151/151] wip center layout garbage
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/re-search: 151/151] wip center layout garbage
- Date: Thu, 1 Nov 2012 17:01:14 +0000 (UTC)
commit 555d45f06ce48bf705689673ce02bbf2fff7715a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Oct 15 16:38:03 2012 -0400
wip center layout garbage
js/ui/centerLayout.js | 44 ++++++++++++++++++++++++--------------------
1 files changed, 24 insertions(+), 20 deletions(-)
---
diff --git a/js/ui/centerLayout.js b/js/ui/centerLayout.js
index eef124b..19f6402 100644
--- a/js/ui/centerLayout.js
+++ b/js/ui/centerLayout.js
@@ -50,9 +50,7 @@ const CenterLayout = new Lang.Class({
let [left, center, right] = container.get_children();
// Only support horizontal layouts for now.
- let [leftMinWidth, leftNaturalWidth] = left.get_preferred_width(availWidth);
let [centerMinWidth, centerNaturalWidth] = center.get_preferred_width(availWidth);
- let [rightMinWidth, rightNaturalWidth] = right.get_preferred_width(availWidth);
let sideWidth = (availWidth - centerNaturalWidth) / 2;
@@ -60,30 +58,36 @@ const CenterLayout = new Lang.Class({
childBox.y1 = box.y1;
childBox.y2 = box.y1 + availHeight;
- let leftSide = Math.min(Math.floor(sideWidth), leftNaturalWidth);
- if (rtl) {
- childBox.x1 = availWidth - leftSide;
- childBox.x2 = availWidth;
- } else {
- childBox.x1 = 0;
- childBox.x2 = leftSide;
+ if (left) {
+ let [leftMinWidth, leftNaturalWidth] = left.get_preferred_width(availWidth);
+ let leftSide = Math.min(Math.floor(sideWidth), leftNaturalWidth);
+ if (rtl) {
+ childBox.x1 = availWidth - leftSide;
+ childBox.x2 = availWidth;
+ } else {
+ childBox.x1 = 0;
+ childBox.x2 = leftSide;
+ }
+ childBox.x1 += box.x1;
+ left.allocate(childBox, flags);
}
- childBox.x1 += box.x1;
- left.allocate(childBox, flags);
childBox.x1 = box.x1 + Math.ceil(sideWidth);
childBox.x2 = childBox.x1 + centerNaturalWidth;
center.allocate(childBox, flags);
- let rightSide = Math.min(Math.floor(sideWidth), rightNaturalWidth);
- if (rtl) {
- childBox.x1 = 0;
- childBox.x2 = rightSide;
- } else {
- childBox.x1 = availWidth - rightSide;
- childBox.x2 = availWidth;
+ if (right) {
+ let [rightMinWidth, rightNaturalWidth] = right.get_preferred_width(availWidth);
+ let rightSide = Math.min(Math.floor(sideWidth), rightNaturalWidth);
+ if (rtl) {
+ childBox.x1 = 0;
+ childBox.x2 = rightSide;
+ } else {
+ childBox.x1 = availWidth - rightSide;
+ childBox.x2 = availWidth;
+ }
+ childBox.x1 += box.x1;
+ right.allocate(childBox, flags);
}
- childBox.x1 += box.x1;
- right.allocate(childBox, flags);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]