[gnome-shell/wip/swarm: 1/10] appDisplay: Reset to page 0 on mapped changed
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/swarm: 1/10] appDisplay: Reset to page 0 on mapped changed
- Date: Wed, 13 Aug 2014 15:51:26 +0000 (UTC)
commit 10e7b31159db23ee90f3a8fa8a80896f1de9d83d
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Thu Jun 26 21:28:29 2014 +0200
appDisplay: Reset to page 0 on mapped changed
We always want to reset to page 0 on reopening the all view. Currently
we do that only on some cases, like hiding the overview, but not on some
others which is necessary to achieve this. So there were bugs on some of
those cases, since the activePage was not in sync with the current page
that the user is seeing active.
To avoid that, reset to page 0 on mapped property of the main actor of
all view changes.
https://bugzilla.gnome.org/show_bug.cgi?id=734680
js/ui/appDisplay.js | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index c32acb6..1ba0937 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -313,7 +313,7 @@ const AllView = new Lang.Class({
this._pageIndicators = new PageIndicators();
this._pageIndicators.connect('page-activated', Lang.bind(this,
function(indicators, pageIndex) {
- this.goToPage(pageIndex);
+ this.goToPage(pageIndex, true);
}));
this._pageIndicators.actor.connect('scroll-event', Lang.bind(this, this._onScroll));
this.actor.add_actor(this._pageIndicators.actor);
@@ -357,10 +357,6 @@ const AllView = new Lang.Class({
this._availWidth = 0;
this._availHeight = 0;
- Main.overview.connect('hidden', Lang.bind(this,
- function() {
- this.goToPage(0);
- }));
this._grid.connect('space-opened', Lang.bind(this,
function() {
this._scrollView.get_effect('fade').enabled = false;
@@ -373,6 +369,7 @@ const AllView = new Lang.Class({
this.actor.connect('notify::mapped', Lang.bind(this,
function() {
+ this.goToPage(0, false);
if (this.actor.mapped) {
this._keyPressEventId =
global.stage.connect('key-press-event',
@@ -459,7 +456,7 @@ const AllView = new Lang.Class({
return this._grid.getPageY(this._currentPage);
},
- goToPage: function(pageNumber) {
+ goToPage: function(pageNumber, animate) {
pageNumber = clamp(pageNumber, 0, this._grid.nPages() - 1);
if (this._currentPage == pageNumber && this._displayingPopup && this._currentPopup)
@@ -467,6 +464,13 @@ const AllView = new Lang.Class({
if (this._displayingPopup && this._currentPopup)
this._currentPopup.popdown();
+ if (!animate) {
+ this._currentPage = pageNumber;
+ this._adjustment.value = this._grid.getPageY(this._currentPage);
+ this._pageIndicators.setCurrentPage(pageNumber);
+ return;
+ }
+
let velocity;
if (!this._panning)
velocity = 0;
@@ -524,9 +528,9 @@ const AllView = new Lang.Class({
let direction = event.get_scroll_direction();
if (direction == Clutter.ScrollDirection.UP)
- this.goToPage(this._currentPage - 1);
+ this.goToPage(this._currentPage - 1, true);
else if (direction == Clutter.ScrollDirection.DOWN)
- this.goToPage(this._currentPage + 1);
+ this.goToPage(this._currentPage + 1, true);
return Clutter.EVENT_STOP;
},
@@ -556,7 +560,7 @@ const AllView = new Lang.Class({
let endPanValue = this._adjustment.value + velocity;
let closestPage = Math.round(endPanValue / pageHeight);
- this.goToPage(closestPage);
+ this.goToPage(closestPage, true);
this._panning = false;
},
@@ -566,10 +570,10 @@ const AllView = new Lang.Class({
return Clutter.EVENT_STOP;
if (event.get_key_symbol() == Clutter.Page_Up) {
- this.goToPage(this._currentPage - 1);
+ this.goToPage(this._currentPage - 1, true);
return Clutter.EVENT_STOP;
} else if (event.get_key_symbol() == Clutter.Page_Down) {
- this.goToPage(this._currentPage + 1);
+ this.goToPage(this._currentPage + 1, true);
return Clutter.EVENT_STOP;
}
@@ -590,7 +594,7 @@ const AllView = new Lang.Class({
_keyFocusIn: function(icon) {
let itemPage = this._grid.getItemPage(icon);
- this.goToPage(itemPage);
+ this.goToPage(itemPage, true);
},
_updateIconOpacities: function(folderOpen) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]