Commit 13b35bd8 authored by Furkan Tokac's avatar Furkan Tokac 💬

Mouse KCM Pointer Speed Slider Improvement

Summary:
Slider value to libinput value mapping algorithm is changed. Tested and everything is working fine.
You can test it by changing value on slider and checking the libinput value from ~/.config/kcminputrc

BUG: 395681

Reviewers: ngraham, romangg, #plasma, mart

Reviewed By: ngraham, romangg, #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D13672
parent 6a4b5870
......@@ -188,25 +188,28 @@ Kirigami.ScrollablePage {
Controls.Slider {
Kirigami.FormData.label: i18n("Pointer speed:")
id: accelSpeed
from: 1
to: 10
to: 11
stepSize: 1
function load() {
enabled = device.supportsPointerAcceleration
if (!enabled) {
value = 0.1
value = 0.2
return
}
// transform libinput's pointer acceleration range [-1, 1] to slider range [1, 10]
value = 4.5 * device.pointerAcceleration + 5.5
// transform libinput's pointer acceleration range [-1, 1] to slider range [1, 11]
//value = 4.5 * device.pointerAcceleration + 5.5
value = 6 + device.pointerAcceleration / 0.2
}
onValueChanged: {
if (device != undefined && enabled && !root.loading) {
// transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1]
device.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100
// by *10 and /10, we ignore the floating points after 1 digit. This prevents from
// having a libinput value like 0.60000001
device.pointerAcceleration = Math.round(((value-6) * 0.2) * 10) / 10
root.changeSignal()
}
}
......
......@@ -121,23 +121,26 @@ Kirigami.ScrollablePage {
id: accelSpeed
from: 1
to: 10
to: 11
stepSize: 1
function load() {
enabled = device.supportsPointerAcceleration
if (!enabled) {
value = 0.1
value = 0.2
return
}
// transform libinput's pointer acceleration range [-1, 1] to slider range [1, 10]
value = 4.5 * device.pointerAcceleration + 5.5
// transform libinput's pointer acceleration range [-1, 1] to slider range [1, 11]
//value = 4.5 * device.pointerAcceleration + 5.5
value = 6 + device.pointerAcceleration / 0.2
}
onValueChanged: {
if (device != undefined && enabled && !root.loading) {
// transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1]
device.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100
// by *10 and /10, we ignore the floating points after 1 digit. This prevents from
// having a libinput value like 0.60000001
device.pointerAcceleration = Math.round(((value-6) * 0.2) * 10) / 10
root.changeSignal()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment