diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-29 09:48:44 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-29 09:48:44 +0100 |
| commit | 8ba0f00279cf5264c9aad4323afbc6887bf76f57 (patch) | |
| tree | 8303ac716076058f134ba86b6ee906751ef23898 | |
| parent | 61467b2d35c9b78b352908f8236c0afea45cf635 (diff) | |
| download | quickshell-8ba0f00279cf5264c9aad4323afbc6887bf76f57.tar.gz quickshell-8ba0f00279cf5264c9aad4323afbc6887bf76f57.zip | |
The settings window's fix applied everywhere: under Wayland a mouse
notch carries pixelDelta 15, which Flickable trusts, so the drawer
tiles, notification list, clipboard, notes, assistant lists, steps
window, OBS scenes, hosts and bookmarks all crawled 15px a notch.
Bookmarks had its own handler that preferred a non-zero pixelDelta and
so carried the same bug at 30px.
WheelScroll.qml moves to shared/ and is linked from desktop/, hosts/
and bookmarks/, as Theme.qml is. Steps: a tile row for the drawer,
three card rows for bookmarks, 60px for the two small text boxes, 40px
for OBS scenes, 150px elsewhere. Its clamp now honours topMargin and
bottomMargin, which bookmarks' grid uses.
The animated step fires no movementStarted, which the assistant chat
used to stop following a streaming reply once the user scrolled up, so
WheelScroll gains a settled signal and the chat sets stick from atYEnd
on it.
games/ is untouched: its PathView steps one tile per notch on
angleDelta and never had the bug.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | AGENTS.md | 8 | ||||
| -rw-r--r-- | bookmarks/Bookmarks.qml | 20 | ||||
| l--------- | bookmarks/WheelScroll.qml | 1 | ||||
| -rw-r--r-- | desktop/Drawer.qml | 1 | ||||
| -rw-r--r-- | desktop/NotificationList.qml | 1 | ||||
| l---------[-rw-r--r--] | desktop/WheelScroll.qml | 56 | ||||
| -rw-r--r-- | desktop/assistant/Card.qml | 2 | ||||
| -rw-r--r-- | desktop/assistant/History.qml | 1 | ||||
| -rw-r--r-- | desktop/assistant/Models.qml | 1 | ||||
| -rw-r--r-- | desktop/assistant/Picker.qml | 1 | ||||
| -rw-r--r-- | desktop/island/ObsPill.qml | 2 | ||||
| -rw-r--r-- | desktop/modules/appearance/StepsWindow.qml | 2 | ||||
| -rw-r--r-- | desktop/modules/assistant/AssistantPage.qml | 2 | ||||
| -rw-r--r-- | desktop/modules/clipboard/ClipboardPage.qml | 1 | ||||
| -rw-r--r-- | desktop/modules/notes/NotesPage.qml | 1 | ||||
| -rw-r--r-- | hosts/Hosts.qml | 1 | ||||
| l--------- | hosts/WheelScroll.qml | 1 | ||||
| -rw-r--r-- | shared/WheelScroll.qml | 61 |
18 files changed, 93 insertions, 70 deletions
@@ -182,6 +182,14 @@ changing that component. The ones that generalise: never reached a full-surface `MouseArea` below the panel while a page was open. A `MouseArea` on top with `z: 1` and `acceptedButtons: Qt.BackButton` works, and left clicks still pass through it to the items below. +- **Under Wayland a mouse wheel notch arrives with `pixelDelta` 15**, beside + `angleDelta` 120, on a device Qt types as a touchpad (measured). Flickable + trusts the pixel delta, so every list scrolled 15px a notch whatever + `maximumFlickVelocity` said, and a handler preferring a non-zero + `pixelDelta` inherits the bug. Every vertical scroller takes + `shared/WheelScroll.qml` instead: `angleDelta` only, a fixed animated + step per notch. A new one needs it too, and a symlink if its shell has + none. Its animation fires no `movementStarted`; listen to `settled`. - **A `WheelHandler` on an `Image` inside the island's status pill never fired**; `MouseArea { onWheel }` in the same place works, and `SoundPage` already used it. Prefer `MouseArea.onWheel`. diff --git a/bookmarks/Bookmarks.qml b/bookmarks/Bookmarks.qml index edb1ac5..8ca4099 100644 --- a/bookmarks/Bookmarks.qml +++ b/bookmarks/Bookmarks.qml @@ -576,22 +576,12 @@ Scope { } } - // Flickable's own wheel step is a few pixels a notch - // and dragged on 500 bookmarks. This scrolls 3 rows of - // cards a notch instead; buttons pass through to the - // cards. A MouseArea, as WheelHandler never fired in - // the island. - MouseArea { + // Three rows of cards a notch, animated (WheelScroll.qml); + // buttons pass through to the cards. + WheelScroll { anchors.fill: grid - acceptedButtons: Qt.NoButton - onWheel: wheel => { - const step = wheel.pixelDelta.y !== 0 ? wheel.pixelDelta.y * 2 - : wheel.angleDelta.y / 120 * 3 * (72 + grid.gap); - const top = grid.originY - grid.topMargin; - const bottom = Math.max(top, grid.originY + grid.contentHeight - + grid.bottomMargin - grid.height); - grid.contentY = Math.max(top, Math.min(bottom, grid.contentY - step)); - } + flick: grid + step: 3 * (72 + grid.gap) } } } diff --git a/bookmarks/WheelScroll.qml b/bookmarks/WheelScroll.qml new file mode 120000 index 0000000..f6de73f --- /dev/null +++ b/bookmarks/WheelScroll.qml @@ -0,0 +1 @@ +../shared/WheelScroll.qml
\ No newline at end of file diff --git a/desktop/Drawer.qml b/desktop/Drawer.qml index 93493cc..f77169a 100644 --- a/desktop/Drawer.qml +++ b/desktop/Drawer.qml @@ -230,6 +230,7 @@ Scope { contentHeight: grid.height clip: true boundsBehavior: Flickable.StopAtBounds + WheelScroll { parent: tiles; anchors.fill: parent; flick: tiles; step: 96 + grid.spacing } Flow { id: grid diff --git a/desktop/NotificationList.qml b/desktop/NotificationList.qml index 9fe4328..63ab1aa 100644 --- a/desktop/NotificationList.qml +++ b/desktop/NotificationList.qml @@ -61,6 +61,7 @@ Item { contentWidth: width contentHeight: col.implicitHeight boundsBehavior: Flickable.StopAtBounds + WheelScroll { parent: flick; anchors.fill: parent; flick: flick } Column { id: col diff --git a/desktop/WheelScroll.qml b/desktop/WheelScroll.qml index 845a8ff..f6de73f 100644..120000 --- a/desktop/WheelScroll.qml +++ b/desktop/WheelScroll.qml @@ -1,55 +1 @@ -// 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(); - } -} +../shared/WheelScroll.qml
\ No newline at end of file diff --git a/desktop/assistant/Card.qml b/desktop/assistant/Card.qml index 2f9af69..f4e1af1 100644 --- a/desktop/assistant/Card.qml +++ b/desktop/assistant/Card.qml @@ -252,6 +252,7 @@ Rectangle { onMovementStarted: stick = false onMovementEnded: stick = atYEnd onContentHeightChanged: if (stick) Qt.callLater(positionViewAtEnd) + WheelScroll { parent: list; anchors.fill: parent; flick: list; onSettled: list.stick = list.atYEnd } Component.onCompleted: positionViewAtEnd() delegate: Message { @@ -588,6 +589,7 @@ Rectangle { contentHeight: input.contentHeight clip: true boundsBehavior: Flickable.StopAtBounds + WheelScroll { parent: scroller; anchors.fill: parent; flick: scroller; step: 60 } function follow(r) { if (r.y < contentY) contentY = r.y; else if (r.y + r.height > contentY + height) contentY = r.y + r.height - height; diff --git a/desktop/assistant/History.qml b/desktop/assistant/History.qml index 709e1a6..1b2a355 100644 --- a/desktop/assistant/History.qml +++ b/desktop/assistant/History.qml @@ -58,6 +58,7 @@ Rectangle { spacing: 4 boundsBehavior: Flickable.StopAtBounds model: field.text.trim() === "" ? panel.canvas.convs : panel.canvas.results + WheelScroll { parent: rows; anchors.fill: parent; flick: rows } delegate: Rectangle { id: r diff --git a/desktop/assistant/Models.qml b/desktop/assistant/Models.qml index b1b2a38..1fa1d37 100644 --- a/desktop/assistant/Models.qml +++ b/desktop/assistant/Models.qml @@ -30,6 +30,7 @@ Rectangle { clip: true spacing: 2 model: panel.canvas.models + WheelScroll { parent: rows; anchors.fill: parent; flick: rows } delegate: Rectangle { id: r diff --git a/desktop/assistant/Picker.qml b/desktop/assistant/Picker.qml index 6d7b8ad..4c691ec 100644 --- a/desktop/assistant/Picker.qml +++ b/desktop/assistant/Picker.qml @@ -108,6 +108,7 @@ Rectangle { boundsBehavior: Flickable.StopAtBounds model: files highlightMoveDuration: 0 + WheelScroll { parent: rows; anchors.fill: parent; flick: rows } delegate: Rectangle { id: r diff --git a/desktop/island/ObsPill.qml b/desktop/island/ObsPill.qml index 3fdb4a3..c4b0870 100644 --- a/desktop/island/ObsPill.qml +++ b/desktop/island/ObsPill.qml @@ -134,11 +134,13 @@ Capsule { // ponytail: four columns, two rows visible; the wheel scrolls beyond // eight scenes. Selection is click-only, so scrolling never switches. Flickable { + id: scenes width: controls.width height: Math.min(80, grid.childrenRect.height) contentHeight: grid.childrenRect.height clip: true flickableDirection: Flickable.VerticalFlick + WheelScroll { parent: scenes; anchors.fill: parent; flick: scenes; step: 40 } Grid { id: grid diff --git a/desktop/modules/appearance/StepsWindow.qml b/desktop/modules/appearance/StepsWindow.qml index aeb77fe..dcfe705 100644 --- a/desktop/modules/appearance/StepsWindow.qml +++ b/desktop/modules/appearance/StepsWindow.qml @@ -106,6 +106,7 @@ Scope { } Flickable { + id: steps width: parent.width // Sized from the screen, never from the window: the // window's height comes from this, and a binding back @@ -114,6 +115,7 @@ Scope { win.screen.height - 240 - tabBar.implicitHeight - actions.implicitHeight - 32) contentHeight: content.implicitHeight clip: true + WheelScroll { parent: steps; anchors.fill: parent; flick: steps } Column { id: content diff --git a/desktop/modules/assistant/AssistantPage.qml b/desktop/modules/assistant/AssistantPage.qml index 0875a5d..a952b4f 100644 --- a/desktop/modules/assistant/AssistantPage.qml +++ b/desktop/modules/assistant/AssistantPage.qml @@ -398,7 +398,9 @@ Column { color: Theme.surface ScrollView { + id: promptScroll anchors { fill: parent; margins: 8 } + WheelScroll { parent: promptScroll; anchors.fill: parent; flick: promptScroll.contentItem; step: 60 } TextArea { id: prompt wrapMode: TextEdit.Wrap diff --git a/desktop/modules/clipboard/ClipboardPage.qml b/desktop/modules/clipboard/ClipboardPage.qml index 945557c..9b48909 100644 --- a/desktop/modules/clipboard/ClipboardPage.qml +++ b/desktop/modules/clipboard/ClipboardPage.qml @@ -101,6 +101,7 @@ Item { highlightMoveDuration: 0 boundsBehavior: Flickable.StopAtBounds ScrollBar.vertical: ScrollBar {} + WheelScroll { parent: list; anchors.fill: parent; flick: list } Text { anchors.centerIn: parent diff --git a/desktop/modules/notes/NotesPage.qml b/desktop/modules/notes/NotesPage.qml index c4563e0..8130c7e 100644 --- a/desktop/modules/notes/NotesPage.qml +++ b/desktop/modules/notes/NotesPage.qml @@ -221,6 +221,7 @@ Item { model: Notes.filter(page.owner.notes, search.text) boundsBehavior: Flickable.StopAtBounds ScrollBar.vertical: ScrollBar {} + WheelScroll { parent: list; anchors.fill: parent; flick: list } delegate: Rectangle { id: row diff --git a/hosts/Hosts.qml b/hosts/Hosts.qml index 6dc4ea2..3671f75 100644 --- a/hosts/Hosts.qml +++ b/hosts/Hosts.qml @@ -250,6 +250,7 @@ Scope { clip: true contentHeight: rows.height + 48 boundsBehavior: Flickable.StopAtBounds + WheelScroll { parent: grid; anchors.fill: parent; flick: grid } // Keep the selected card in view as the arrows move. function reveal(i) { diff --git a/hosts/WheelScroll.qml b/hosts/WheelScroll.qml new file mode 120000 index 0000000..f6de73f --- /dev/null +++ b/hosts/WheelScroll.qml @@ -0,0 +1 @@ +../shared/WheelScroll.qml
\ No newline at end of file diff --git a/shared/WheelScroll.qml b/shared/WheelScroll.qml new file mode 100644 index 0000000..d7e4b3f --- /dev/null +++ b/shared/WheelScroll.qml @@ -0,0 +1,61 @@ +// 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 + // At the end of each animated step: a programmatic contentY change + // fires no movementStarted/Ended, so a view tracking user scrolls + // listens here instead (assistant/Card.qml). + signal settled() + + acceptedButtons: Qt.NoButton + + function clamp(y) { + const top = flick.originY - flick.topMargin; + return Math.max(top, Math.min(y, Math.max(top, + flick.originY + flick.contentHeight + flick.bottomMargin - flick.height))); + } + + NumberAnimation { + id: anim + target: ws.flick + property: "contentY" + duration: 180 + easing.type: Easing.OutCubic + onFinished: ws.settled() + } + + 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(); + } +} |
