mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-17 00:34:01 -04:00
bar: detect touchpads by scroll phase instead of pixelDelta
This commit is contained in:
@@ -529,12 +529,12 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
repo:
|
||||
- dgop
|
||||
- dankgo
|
||||
# - dgop
|
||||
# - dankgo
|
||||
# - dank-qml-common
|
||||
# - dankcalendar
|
||||
- danksearch
|
||||
- dank-greeter
|
||||
# - danksearch
|
||||
# - dank-greeter
|
||||
steps:
|
||||
- name: Create GitHub App token
|
||||
id: app_token
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
.pragma library
|
||||
|
||||
// Qt Wayland sends scroll phases only for the finger axis source; pixelDelta also comes with wheels from Qt 6.12 (qtbase d19bd66b4)
|
||||
const Kind = Object.freeze({
|
||||
none: "none",
|
||||
touchpad: "touchpad",
|
||||
wheel: "wheel",
|
||||
highResWheel: "highResWheel"
|
||||
});
|
||||
|
||||
function isTouchpad(wheel) {
|
||||
if (wheel.phase === Qt.NoScrollPhase)
|
||||
return false;
|
||||
return wheel.pixelDelta.x !== 0 || wheel.pixelDelta.y !== 0;
|
||||
}
|
||||
|
||||
function verticalKind(wheel) {
|
||||
if (isTouchpad(wheel))
|
||||
return Kind.touchpad;
|
||||
const angle = wheel.angleDelta.y;
|
||||
if (angle === 0)
|
||||
return Kind.none;
|
||||
return angle % 120 === 0 ? Kind.wheel : Kind.highResWheel;
|
||||
}
|
||||
|
||||
function anyAxisDelta(wheel) {
|
||||
const point = isTouchpad(wheel) ? wheel.pixelDelta : wheel.angleDelta;
|
||||
return point.x || point.y;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import "../../Common/WheelInput.js" as WheelInput
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
@@ -93,16 +94,15 @@ MouseArea {
|
||||
|
||||
const deltaY = wheel.angleDelta.y;
|
||||
const deltaX = wheel.angleDelta.x;
|
||||
const isTouchpadY = wheel.pixelDelta && wheel.pixelDelta.y !== 0;
|
||||
const isTouchpadX = wheel.pixelDelta && wheel.pixelDelta.x !== 0;
|
||||
const isTouchpad = WheelInput.isTouchpad(wheel);
|
||||
|
||||
if (CompositorService.isNiri && xBehavior !== "none" && Math.abs(deltaX) > Math.abs(deltaY)) {
|
||||
accumulateX(isTouchpadX, deltaX, xBehavior);
|
||||
accumulateX(isTouchpad, deltaX, xBehavior);
|
||||
return;
|
||||
}
|
||||
if (yBehavior === "none")
|
||||
return;
|
||||
accumulateY(isTouchpadY, deltaY, yBehavior);
|
||||
accumulateY(isTouchpad, deltaY, yBehavior);
|
||||
}
|
||||
|
||||
onWheel: wheel => processWheel(wheel)
|
||||
|
||||
@@ -8,6 +8,7 @@ import Quickshell.WindowManager
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import "../../../Common/WheelInput.js" as WheelInput
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -992,7 +993,7 @@ Item {
|
||||
return;
|
||||
|
||||
const delta = wheel.angleDelta.y;
|
||||
const isTouchpad = wheel.pixelDelta && wheel.pixelDelta.y !== 0;
|
||||
const isTouchpad = WheelInput.isTouchpad(wheel);
|
||||
const reverse = SettingsData.reverseScrolling ? -1 : 1;
|
||||
|
||||
if (isTouchpad) {
|
||||
|
||||
Reference in New Issue
Block a user