aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop/Page.qml17
-rw-r--r--desktop/Settings.qml8
-rw-r--r--desktop/WheelScroll.qml55
-rw-r--r--desktop/modules/appearance/WallpaperTab.qml15
4 files changed, 69 insertions, 26 deletions
diff --git a/desktop/Page.qml b/desktop/Page.qml
index 02b2da8..e02db7e 100644
--- a/desktop/Page.qml
+++ b/desktop/Page.qml
@@ -138,12 +138,6 @@ Item {
anchors.topMargin: 12
clip: true
contentWidth: availableWidth
- // Faster wheel scrolling than Qt's defaults (2500, 1500); the
- // sidebar and the landing page in Settings.qml use the same pair.
- Component.onCompleted: {
- scroll.contentItem.maximumFlickVelocity = 8000;
- scroll.contentItem.flickDeceleration = 4000;
- }
// Page Up/Down, Home/End scroll the page. Reached when the page
// itself has focus (a click on empty space, below) or bubbling up
@@ -167,13 +161,16 @@ Item {
}
}
- // A click on empty page space focuses the page, for the keys above.
- // Beneath the content, so fields and buttons keep their clicks; it takes
- // no wheel (no onWheel) and the Flickable still steals drags from it.
- MouseArea {
+ // A click on empty page space focuses the page, for the keys above,
+ // and the wheel scrolls it. Beneath the content, so fields and buttons
+ // keep their clicks and an inner slider or list keeps its wheel; the
+ // Flickable still steals drags from it.
+ WheelScroll {
parent: holder
z: -1
anchors.fill: parent
+ flick: scroll.contentItem
+ acceptedButtons: Qt.LeftButton
onPressed: scroll.forceActiveFocus()
}
diff --git a/desktop/Settings.qml b/desktop/Settings.qml
index 2e151a9..56f911f 100644
--- a/desktop/Settings.qml
+++ b/desktop/Settings.qml
@@ -228,9 +228,7 @@ Scope {
// Without it a scrolled list draws over the search box.
clip: true
model: root.found
- // Faster wheel scrolling, as Page.qml.
- maximumFlickVelocity: 8000
- flickDeceleration: 4000
+ WheelScroll { parent: side; anchors.fill: parent; flick: side; step: 120 }
// A group's heading above its first entry, then the entry.
delegate: Column {
@@ -452,10 +450,8 @@ Scope {
contentHeight: about.height
clip: true
boundsBehavior: Flickable.StopAtBounds
- // Faster wheel scrolling, as Page.qml.
- maximumFlickVelocity: 8000
- flickDeceleration: 4000
ScrollBar.vertical: ScrollBar {}
+ WheelScroll { parent: landingFlick; anchors.fill: parent; flick: landingFlick }
Column {
id: about
diff --git a/desktop/WheelScroll.qml b/desktop/WheelScroll.qml
new file mode 100644
index 0000000..845a8ff
--- /dev/null
+++ b/desktop/WheelScroll.qml
@@ -0,0 +1,55 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+
+// Mouse wheel scrolling for a Flickable: a fixed distance per notch,
+// animated, the same up and down. Qt's own wheel handling took a long
+// list dozens of notches whatever maximumFlickVelocity said. Notches that arrive mid-animation add to its
+// end point, so a fast spin travels further.
+//
+// angleDelta only. Under Wayland a mouse notch arrives as angleDelta 120
+// with pixelDelta 15 and a device typed touchpad (measured), so trusting
+// a non-zero pixelDelta, as Flickable does, scrolled 15px a notch.
+// ponytail: a real touchpad then scrolls by step too; tell the two apart
+// (e.g. pixelDelta != angleDelta / 8) if one is ever used here.
+//
+// Takes no buttons, so clicks reach what is under it; wheel events that
+// an inner item (a slider, a nested list) accepts never reach it.
+MouseArea {
+ id: ws
+ property Flickable flick
+ // Pixels per notch.
+ property real step: 150
+
+ acceptedButtons: Qt.NoButton
+
+ function clamp(y) {
+ return Math.max(flick.originY, Math.min(y,
+ flick.originY + Math.max(0, flick.contentHeight - flick.height)));
+ }
+
+ NumberAnimation {
+ id: anim
+ target: ws.flick
+ property: "contentY"
+ duration: 180
+ easing.type: Easing.OutCubic
+ }
+
+ onWheel: wheel => {
+ flick.cancelFlick();
+ const from = anim.running ? anim.to : flick.contentY;
+ anim.stop();
+ anim.to = clamp(from - wheel.angleDelta.y / 120 * step);
+ anim.start();
+ }
+}
diff --git a/desktop/modules/appearance/WallpaperTab.qml b/desktop/modules/appearance/WallpaperTab.qml
index cf41a4d..b51b710 100644
--- a/desktop/modules/appearance/WallpaperTab.qml
+++ b/desktop/modules/appearance/WallpaperTab.qml
@@ -518,18 +518,13 @@ Column {
}
}
- // The default wheel step moves a fraction of a thumbnail; a
- // notch here moves one row. A touchpad's pixel delta is kept.
- MouseArea {
+ // A notch moves one row, animated. On top of the thumbnails,
+ // none of which takes the wheel.
+ WheelScroll {
parent: wallList
anchors.fill: parent
- acceptedButtons: Qt.NoButton
- onWheel: wheel => {
- const d = wheel.pixelDelta.y !== 0 ? wheel.pixelDelta.y
- : wheel.angleDelta.y / 120 * wallList.thumbHeight;
- wallList.contentY = Math.max(wallList.originY, Math.min(
- wallList.originY + wallList.contentHeight - wallList.height, wallList.contentY - d));
- }
+ flick: wallList
+ step: wallList.thumbHeight
}
}
}