From 5c1147db87f6975b391f0f737f552abf0cf865a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 7 Aug 2008 19:03:06 +0000 Subject: [PATCH] * Apply the same trick to the acceleration value, too. * When reading the settings, get smoother values also. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26868 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/mouse/MouseWindow.cpp | 6 ++++-- src/preferences/mouse/SettingsView.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/preferences/mouse/MouseWindow.cpp b/src/preferences/mouse/MouseWindow.cpp index cbe7f84c58..474cc8c3a3 100644 --- a/src/preferences/mouse/MouseWindow.cpp +++ b/src/preferences/mouse/MouseWindow.cpp @@ -161,7 +161,8 @@ MouseWindow::MessageReceived(BMessage *message) int32 value; if (message->FindInt32("be:value", &value) == B_OK) { // slow = 8192, fast = 524287 - fSettings.SetMouseSpeed((int32)pow(2, (double)value * 6 / 1000) * 8192); + fSettings.SetMouseSpeed((int32)pow(2, + value * 6.0 / 1000) * 8192); fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); fRevertButton->SetEnabled(true); } @@ -173,7 +174,8 @@ MouseWindow::MessageReceived(BMessage *message) int32 value; if (message->FindInt32("be:value", &value) == B_OK) { // slow = 0, fast = 262144 - fSettings.SetAccelerationFactor((int32)pow(value * 4 / 1000, 2) * 16384); + fSettings.SetAccelerationFactor((int32)pow( + value * 4.0 / 1000, 2) * 16384); fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); fRevertButton->SetEnabled(true); } diff --git a/src/preferences/mouse/SettingsView.cpp b/src/preferences/mouse/SettingsView.cpp index 0c3726f22a..2ac94b68ce 100644 --- a/src/preferences/mouse/SettingsView.cpp +++ b/src/preferences/mouse/SettingsView.cpp @@ -283,11 +283,11 @@ SettingsView::UpdateFromSettings() // slow = 1000000, fast = 0 fClickSpeedSlider->SetValue(value); - value = int32((log(fSettings.MouseSpeed() / 8192) / log(2)) * 1000 / 6); + value = int32((log(fSettings.MouseSpeed() / 8192.0) / log(2)) * 1000 / 6); // slow = 8192, fast = 524287 fMouseSpeedSlider->SetValue(value); - value = int32(sqrt(fSettings.AccelerationFactor() / 16384) * 1000 / 4); + value = int32(sqrt(fSettings.AccelerationFactor() / 16384.0) * 1000 / 4); // slow = 0, fast = 262144 fAccelerationSlider->SetValue(value);