From 998d703bc24441dae5f1ac5436de15ab7527b7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 15 Nov 2023 14:31:37 +0100 Subject: [PATCH] js: Stop using {v,h}scroll properties We only use them to access the corresponding adjustments, and ScrollView now exposes those directly. Part-of: --- js/gdm/authList.js | 2 +- js/gdm/loginDialog.js | 4 ++-- js/misc/animationUtils.js | 2 +- js/ui/appDisplay.js | 5 ++--- js/ui/components/telepathyClient.js | 6 +++--- js/ui/lookingGlass.js | 6 +++--- js/ui/search.js | 2 +- js/ui/switcherPopup.js | 6 +++--- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/js/gdm/authList.js b/js/gdm/authList.js index e0351a271..7f860a781 100644 --- a/js/gdm/authList.js +++ b/js/gdm/authList.js @@ -128,7 +128,7 @@ export const AuthList = GObject.registerClass({ scrollToItem(item) { let box = item.get_allocation_box(); - const {adjustment} = this._scrollView.vscroll; + const adjustment = this._scrollView.vadjustment; let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0); adjustment.ease(value, { diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index f3afdbb5e..8644bf3d5 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -224,7 +224,7 @@ const UserList = GObject.registerClass({ scrollToItem(item) { let box = item.get_allocation_box(); - const {adjustment} = this.vscroll; + const adjustment = this.vadjustment; let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0); adjustment.ease(value, { @@ -236,7 +236,7 @@ const UserList = GObject.registerClass({ jumpToItem(item) { let box = item.get_allocation_box(); - const {adjustment} = this.vscroll; + const adjustment = this.vadjustment; let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0); diff --git a/js/misc/animationUtils.js b/js/misc/animationUtils.js index 1562f1018..a7a0ea8b0 100644 --- a/js/misc/animationUtils.js +++ b/js/misc/animationUtils.js @@ -32,7 +32,7 @@ export function adjustAnimationTime(msecs) { * @param {Clutter.Actor} actor - the actor */ export function ensureActorVisibleInScrollView(scrollView, actor) { - const {adjustment} = scrollView.vscroll; + const adjustment = scrollView.vadjustment; let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values(); let offset = 0; diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 44bcd3dbf..b03f024ac 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -529,8 +529,7 @@ var BaseAppView = GObject.registerClass({ this._scrollTimeoutId = 0; this._scrollView.connect('scroll-event', this._onScroll.bind(this)); - const scroll = this._scrollView.hscroll; - this._adjustment = scroll.adjustment; + this._adjustment = this._scrollView.hadjustment; this._adjustment.connect('notify::value', adj => { const value = adj.value / adj.page_size; this._pageIndicators.setCurrentPosition(value); @@ -2375,7 +2374,7 @@ export const FolderIcon = GObject.registerClass({ open() { this._ensureFolderDialog(); - this.view._scrollView.vscroll.adjustment.value = 0; + this.view._scrollView.vadjustment.value = 0; this._dialog.popup(); } diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index 41f1be704..4a66d9151 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -890,8 +890,8 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner { // Keep track of the bottom position for the current adjustment and // force a scroll to the bottom if things change while we were at the // bottom - this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value; - this._scrollArea.vscroll.adjustment.connect('changed', adjustment => { + this._oldMaxScrollValue = this._scrollArea.vadjustment.value; + this._scrollArea.vadjustment.connect('changed', adjustment => { if (adjustment.value === this._oldMaxScrollValue) this.scrollTo(St.Side.BOTTOM); this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size); @@ -917,7 +917,7 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner { } scrollTo(side) { - let adjustment = this._scrollArea.vscroll.adjustment; + let adjustment = this._scrollArea.vadjustment; if (side === St.Side.TOP) adjustment.value = adjustment.lower; else if (side === St.Side.BOTTOM) diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 8da25d6b4..aa422473f 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -179,7 +179,7 @@ const Notebook = GObject.registerClass({ scrollview.hide(); this.add_child(scrollview); - let vAdjust = scrollview.vscroll.adjustment; + const vAdjust = scrollview.vadjustment; vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData)); vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData)); @@ -238,7 +238,7 @@ const Notebook = GObject.registerClass({ } _onAdjustValueChanged(tabData) { - let vAdjust = tabData.scrollView.vscroll.adjustment; + const vAdjust = tabData.scrollView.vadjustment; if (vAdjust.value < (vAdjust.upper - vAdjust.lower - 0.5)) tabData._scrolltoBottom = false; } @@ -246,7 +246,7 @@ const Notebook = GObject.registerClass({ _onAdjustScopeChanged(tabData) { if (!tabData._scrollToBottom) return; - let vAdjust = tabData.scrollView.vscroll.adjustment; + const vAdjust = tabData.scrollView.vadjustment; vAdjust.value = vAdjust.upper - vAdjust.page_size; } diff --git a/js/ui/search.js b/js/ui/search.js index 2cc357344..63b034d3c 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -751,7 +751,7 @@ export const SearchResultsView = GObject.registerClass({ _onPan(action) { let [dist_, dx_, dy] = action.get_motion_delta(0); - let adjustment = this._scrollView.vscroll.adjustment; + let adjustment = this._scrollView.vadjustment; adjustment.value -= (dy / this.height) * adjustment.page_size; return false; } diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index 9017d2c9e..9b956e8d4 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -501,7 +501,7 @@ export const SwitcherList = GObject.registerClass({ this._highlighted = index; - let adjustment = this._scrollView.hscroll.adjustment; + const adjustment = this._scrollView.hadjustment; let [value] = adjustment.get_values(); let [absItemX] = this._items[index].get_transformed_position(); let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0); @@ -513,7 +513,7 @@ export const SwitcherList = GObject.registerClass({ } _scrollToLeft(index) { - let adjustment = this._scrollView.hscroll.adjustment; + const adjustment = this._scrollView.hadjustment; let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values(); let item = this._items[index]; @@ -536,7 +536,7 @@ export const SwitcherList = GObject.registerClass({ } _scrollToRight(index) { - let adjustment = this._scrollView.hscroll.adjustment; + const adjustment = this._scrollView.hadjustment; let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values(); let item = this._items[index];