| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/touchpad.h" | 5 #include "chrome/browser/chromeos/touchpad.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // To disable vertical edge scroll, we set VertEdgeScroll to 0. Vertical edge | 97 // To disable vertical edge scroll, we set VertEdgeScroll to 0. Vertical edge |
| 98 // scroll lets you use the right edge of the touchpad to control the movement | 98 // scroll lets you use the right edge of the touchpad to control the movement |
| 99 // of the vertical scroll bar. | 99 // of the vertical scroll bar. |
| 100 if (vert_edge_scroll_enabled_.GetValue()) | 100 if (vert_edge_scroll_enabled_.GetValue()) |
| 101 SetSynclientParam("VertEdgeScroll", 1); | 101 SetSynclientParam("VertEdgeScroll", 1); |
| 102 else | 102 else |
| 103 SetSynclientParam("VertEdgeScroll", 0); | 103 SetSynclientParam("VertEdgeScroll", 0); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void Touchpad::SetSpeedFactor() { | 106 void Touchpad::SetSpeedFactor() { |
| 107 // To set speed factor, we use MinSpeed. Both MaxSpeed and AccelFactor are 0. | 107 // To set speed factor, we use MaxSpeed. MinSpeed is set to 0.2. |
| 108 // So MinSpeed will control the speed of the cursor with respect to the | 108 // MaxSpeed can go from 0.2 to 1.1. The preference is an integer between |
| 109 // touchpad movement and there will not be any acceleration. | 109 // 1 and 10, so we divide that by 10 and add 0.1 for the value of MaxSpeed. |
| 110 // MinSpeed is between 0.01 and 1.00. The preference is an integer between | |
| 111 // 1 and 10, so we divide that by 10 for the value of MinSpeed. | |
| 112 int value = speed_factor_.GetValue(); | 110 int value = speed_factor_.GetValue(); |
| 113 if (value < 1) | 111 if (value < 1) |
| 114 value = 1; | 112 value = 1; |
| 115 if (value > 10) | 113 if (value > 10) |
| 116 value = 10; | 114 value = 10; |
| 117 // Convert from 1-10 to 0.1-1.0 | 115 // Convert from 1-10 to 0.2-1.1 |
| 118 double d = static_cast<double>(value) / 10.0; | 116 double d = static_cast<double>(value) / 10.0 + 0.1; |
| 119 SetSynclientParam("MinSpeed", d); | 117 SetSynclientParam("MaxSpeed", d); |
| 120 } | 118 } |
| 121 | 119 |
| 122 void Touchpad::SetSensitivity() { | 120 void Touchpad::SetSensitivity() { |
| 123 // To set the touch sensitivity, we use FingerHigh, which represents the | 121 // To set the touch sensitivity, we use FingerHigh, which represents the |
| 124 // the pressure needed for a tap to be registered. The range of FingerHigh | 122 // the pressure needed for a tap to be registered. The range of FingerHigh |
| 125 // goes from 25 to 70. We store the sensitivity preference as an int from | 123 // goes from 25 to 70. We store the sensitivity preference as an int from |
| 126 // 1 to 10. So we need to map the preference value of 1 to 10 to the | 124 // 1 to 10. So we need to map the preference value of 1 to 10 to the |
| 127 // FingerHigh value of 25 to 70 inversely. | 125 // FingerHigh value of 25 to 70 inversely. |
| 128 int value = sensitivity_.GetValue(); | 126 int value = sensitivity_.GetValue(); |
| 129 if (value < 1) | 127 if (value < 1) |
| 130 value = 1; | 128 value = 1; |
| 131 if (value > 10) | 129 if (value > 10) |
| 132 value = 10; | 130 value = 10; |
| 133 // Convert from 1-10 to 70-25. | 131 // Convert from 1-10 to 70-25. |
| 134 double d = (15 - value) * 5; | 132 double d = (15 - value) * 5; |
| 135 SetSynclientParam("FingerHigh", d); | 133 SetSynclientParam("FingerHigh", d); |
| 136 } | 134 } |
| OLD | NEW |