[gnome-shell] switcherPopup: Use local variable for index in scrolling functions
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] switcherPopup: Use local variable for index in scrolling functions
- Date: Wed, 26 Feb 2020 22:52:42 +0000 (UTC)
commit 172d21cf506e5fb6f49d4bad344323e289365442
Author: Jonas Dreßler <verdre v0yd nl>
Date: Wed Apr 25 23:24:05 2018 +0200
switcherPopup: Use local variable for index in scrolling functions
Make sure the index that's being scrolled to doesn't change while the
scrolling animation is running by using an argument instead of the
this._highlighed class scope variable.
This fixes wrongly shown arrows when selecting new elements faster than
the scrolling animation takes for one index. The check run to disable
the arrow might be checking against a newer index than the one at the
start of the animation which results in the arrow not getting hidden
even if no more scrolling is possible.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/167
js/ui/switcherPopup.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index d026453ca3..16aa24c649 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -467,17 +467,17 @@ var SwitcherList = GObject.registerClass({
let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0);
let [containerWidth] = this.get_transformed_size();
if (posX + this._items[index].get_width() > containerWidth)
- this._scrollToRight();
+ this._scrollToRight(index);
else if (this._items[index].allocation.x1 - value < 0)
- this._scrollToLeft();
+ this._scrollToLeft(index);
}
- _scrollToLeft() {
+ _scrollToLeft(index) {
let adjustment = this._scrollView.hscroll.adjustment;
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
- let item = this._items[this._highlighted];
+ let item = this._items[index];
if (item.allocation.x1 < value)
value = Math.min(0, item.allocation.x1);
@@ -489,18 +489,18 @@ var SwitcherList = GObject.registerClass({
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: POPUP_SCROLL_TIME,
onComplete: () => {
- if (this._highlighted == 0)
+ if (index === 0)
this._scrollableLeft = false;
this.queue_relayout();
},
});
}
- _scrollToRight() {
+ _scrollToRight(index) {
let adjustment = this._scrollView.hscroll.adjustment;
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
- let item = this._items[this._highlighted];
+ let item = this._items[index];
if (item.allocation.x1 < value)
value = Math.max(0, item.allocation.x1);
@@ -512,7 +512,7 @@ var SwitcherList = GObject.registerClass({
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: POPUP_SCROLL_TIME,
onComplete: () => {
- if (this._highlighted == this._items.length - 1)
+ if (index === this._items.length - 1)
this._scrollableRight = false;
this.queue_relayout();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]