[gnome-shell/wip/paging-release: 9/90] IndicatorLayout: fixed allocation
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/paging-release: 9/90] IndicatorLayout: fixed allocation
- Date: Mon, 12 Aug 2013 17:03:59 +0000 (UTC)
commit 59f34d5a959768d561b24a9accd02bb3cd2bfb22
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Mon Aug 12 18:11:36 2013 +0200
IndicatorLayout: fixed allocation
js/ui/appDisplay.js | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index ae3411c..e70646e 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -396,8 +396,8 @@ const IndicatorLayout = Lang.Class({
Extends: Clutter.BoxLayout,
vfunc_get_preferred_width: function(container, forHeight) {
- let childWidth = container.get_children()[0].get_preferred_width(forHeight);
- let totalWidth = childWidth + this.spacing * 2;
+ let [minWidth, natWidth] = container.get_children()[0].get_preferred_width(forHeight);
+ let totalWidth = natWidth + this.spacing * 2;
return [totalWidth, totalWidth];
},
@@ -408,7 +408,7 @@ const IndicatorLayout = Lang.Class({
let availHeight = box.y2 - box.y1;
let availWidth = box.x2 - box.x1;
let [minHeight, natHeight] = children[0].get_preferred_height(availWidth);
- let totalUsedHeight = (this._nPages - 1) * this.spacing * 2 + this._nPages * natHeight;
+ let totalUsedHeight = this._nPages * this.spacing * 2 - this.spacing + this._nPages * natHeight;
let heightPerChild = totalUsedHeight / this._nPages;
let [minWidth, natWidth] = children[0].get_preferred_width(natHeight);
let widthPerChild = natWidth + this.spacing * 2;
@@ -416,8 +416,8 @@ const IndicatorLayout = Lang.Class({
for(let i = 0; i < this._nPages; i++) {
let childBox = new Clutter.ActorBox();
- childBox.x1 = box.x2 - widthPerChild;
- childBox.x2 = box.x2;
+ childBox.x1 = 0;
+ childBox.x2 = availWidth;
childBox.y1 = firstPosition[1] + i * heightPerChild;
childBox.y2 = childBox.y1 + heightPerChild;
children[i].allocate(childBox, flags);
@@ -444,7 +444,6 @@ const AllView = new Lang.Class({
this._paginationIndicatorLayout = new IndicatorLayout({orientation: Clutter.Orientation.VERTICAL});
this._paginationIndicator = new St.Widget({ x_align:3, y_align: 2,
- x_expand:true, y_expand:true,
style_class: 'pages-indicator' });
this._paginationIndicator.set_layout_manager(this._paginationIndicatorLayout);
let layout = new Clutter.BinLayout();
@@ -464,16 +463,24 @@ const AllView = new Lang.Class({
}
this.actor.connect('allocate', Lang.bind(this, this._allocate));
},
-
+
_allocate: function(widget, box, flags) {
let children = this.actor.get_children();
this._paginationView.allocate(box, flags);
let nPages = this._paginationView.nPages();
this._paginationIndicatorLayout._nPages = nPages;
- this._paginationIndicator.allocate(box, flags);
+ let availWidth = box.x2 - box.x1;
+ let availHeight = box.y2 - box.y1;
+ let childBox = new Clutter.ActorBox();
+ let [minWidth, natWidth] = this._paginationIndicator.get_preferred_width(availHeight);
+ childBox.x1 = availWidth - natWidth;
+ childBox.x2 = availWidth;
+ childBox.y1 = 0;
+ childBox.y2 = availHeight;
+ this._paginationIndicator.allocate(childBox, flags);
},
-
+
_onKeyRelease: function(actor, event) {
if (event.get_key_symbol() == Clutter.KEY_Up) {
this._paginationView.goToNextPage();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]