Merge lp:~andreas-pokorny/mir/add-option-to-disable-acceleration into lp:mir
- add-option-to-disable-acceleration
- Merge into development-branch
Status: | Superseded |
---|---|
Proposed branch: | lp:~andreas-pokorny/mir/add-option-to-disable-acceleration |
Merge into: | lp:mir |
Diff against target: |
459 lines (+124/-43) 12 files modified
examples/server_example_input_device_config.cpp (+31/-9) examples/server_example_input_device_config.h (+2/-8) include/client/mir_toolkit/mir_input_device.h (+7/-0) include/platform/mir/input/pointer_settings.h (+4/-0) include/server/mir/input/pointer_configuration.h (+10/-4) src/platforms/evdev/libinput_device.cpp (+26/-9) src/platforms/evdev/libinput_device.h (+1/-0) src/server/input/default_device.cpp (+4/-2) tests/include/mir/test/doubles/mock_libinput.h (+2/-0) tests/mir_test_doubles/mock_libinput.cpp (+12/-0) tests/mir_test_framework/fake_input_device_impl.cpp (+7/-4) tests/unit-tests/input/evdev/test_libinput_device.cpp (+18/-7) |
To merge this branch: | bzr merge lp:~andreas-pokorny/mir/add-option-to-disable-acceleration |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Daniel van Vugt | Needs Fixing | ||
Review via email: mp+280523@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-12-15.
Commit message
add an option to disable pointer acceleration
This is a makeshift for unknown high dpi / high freq mice. This breaks input platform abi
Description of the change
This MP adds a configuration option to disable cursor acceleration for pointing devices. The option is used in a new program option in example servers - and there restricted to mice.
PS Jenkins bot (ps-jenkins) wrote : | # |
Daniel van Vugt (vanvugt) wrote : | # |
Thanks for putting the time into this. I suspect this is slightly the wrong approach though:
+ bool enable_
would be better replaced by an enum that matches enum libinput_
So we could set it as LIBINPUT_
Daniel van Vugt (vanvugt) wrote : | # |
And therefore we would end up calling libinput_
http://
Andreas Pokorny (andreas-pokorny) wrote : | # |
Agreed. I guess that would turn that into a more permanent solution.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3193
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3193
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'examples/server_example_input_device_config.cpp' | |||
2 | --- examples/server_example_input_device_config.cpp 2015-12-06 23:57:03 +0000 | |||
3 | +++ examples/server_example_input_device_config.cpp 2015-12-15 13:25:30 +0000 | |||
4 | @@ -31,21 +31,27 @@ | |||
5 | 31 | 31 | ||
6 | 32 | ///\example server_example_input_device_config.cpp | 32 | ///\example server_example_input_device_config.cpp |
7 | 33 | /// Demonstrate input device configuration | 33 | /// Demonstrate input device configuration |
15 | 34 | 34 | namespace | |
16 | 35 | char const* const me::disable_while_typing_opt = "disable-while-typing"; | 35 | { |
17 | 36 | char const* const me::mouse_cursor_acceleration_bias_opt = "mouse-cursor-acceleration-bias"; | 36 | char const* const disable_while_typing_opt = "disable-while-typing"; |
18 | 37 | char const* const me::mouse_scroll_speed_scale_opt = "mouse-scroll-speed-scale"; | 37 | char const* const mouse_acceleration_profile_opt = "mouse-acceleration-profile"; |
19 | 38 | char const* const me::touchpad_cursor_acceleration_bias_opt = "touchpad-cursor-acceleration-bias"; | 38 | char const* const acceleration_profile_none = "none"; |
20 | 39 | char const* const me::touchpad_scroll_speed_scale_opt = "touchpad-scroll-speed-scale"; | 39 | char const* const acceleration_profile_flat = "flat"; |
21 | 40 | char const* const me::touchpad_scroll_mode_opt = "touchpad-scroll-mode"; | 40 | char const* const acceleration_profile_adaptive = "adaptive"; |
22 | 41 | char const* const mouse_cursor_acceleration_bias_opt = "mouse-cursor-acceleration-bias"; | ||
23 | 42 | char const* const mouse_scroll_speed_scale_opt = "mouse-scroll-speed-scale"; | ||
24 | 43 | char const* const touchpad_cursor_acceleration_bias_opt = "touchpad-cursor-acceleration-bias"; | ||
25 | 44 | char const* const touchpad_scroll_speed_scale_opt = "touchpad-scroll-speed-scale"; | ||
26 | 45 | char const* const touchpad_scroll_mode_opt = "touchpad-scroll-mode"; | ||
27 | 41 | 46 | ||
28 | 42 | char const* const touchpad_scroll_mode_two_finger = "two-finger"; | 47 | char const* const touchpad_scroll_mode_two_finger = "two-finger"; |
29 | 43 | char const* const touchpad_scroll_mode_edge = "edge"; | 48 | char const* const touchpad_scroll_mode_edge = "edge"; |
30 | 44 | 49 | ||
32 | 45 | char const* const me::touchpad_click_mode_opt= "touchpad-click-mode"; | 50 | char const* const touchpad_click_mode_opt= "touchpad-click-mode"; |
33 | 46 | 51 | ||
34 | 47 | char const* const touchpad_click_mode_area = "area"; | 52 | char const* const touchpad_click_mode_area = "area"; |
35 | 48 | char const* const touchpad_click_mode_finger_count = "finger-count"; | 53 | char const* const touchpad_click_mode_finger_count = "finger-count"; |
36 | 54 | } | ||
37 | 49 | 55 | ||
38 | 50 | void me::add_input_device_configuration_options_to(mir::Server& server) | 56 | void me::add_input_device_configuration_options_to(mir::Server& server) |
39 | 51 | { | 57 | { |
40 | @@ -53,6 +59,9 @@ | |||
41 | 53 | server.add_configuration_option(disable_while_typing_opt, | 59 | server.add_configuration_option(disable_while_typing_opt, |
42 | 54 | "Disable touchpad while typing on keyboard configuration [true, false]", | 60 | "Disable touchpad while typing on keyboard configuration [true, false]", |
43 | 55 | false); | 61 | false); |
44 | 62 | server.add_configuration_option(mouse_acceleration_profile_opt, | ||
45 | 63 | "Select acceleration profile for mice and trackballs [none, flat, adaptive]", | ||
46 | 64 | acceleration_profile_adaptive); | ||
47 | 56 | server.add_configuration_option(mouse_cursor_acceleration_bias_opt, | 65 | server.add_configuration_option(mouse_cursor_acceleration_bias_opt, |
48 | 57 | "Bias to the acceleration curve within the range [-1.0, 1.0] for mice", | 66 | "Bias to the acceleration curve within the range [-1.0, 1.0] for mice", |
49 | 58 | 0.0); | 67 | 0.0); |
50 | @@ -93,6 +102,15 @@ | |||
51 | 93 | return mir_touchpad_scroll_mode_none; | 102 | return mir_touchpad_scroll_mode_none; |
52 | 94 | }; | 103 | }; |
53 | 95 | 104 | ||
54 | 105 | auto to_profile = [](std::string const& val) | ||
55 | 106 | { | ||
56 | 107 | if (val == acceleration_profile_flat) | ||
57 | 108 | return mir_pointer_acceleration_profile_flat; | ||
58 | 109 | if (val == acceleration_profile_none) | ||
59 | 110 | return mir_pointer_acceleration_profile_none; | ||
60 | 111 | return mir_pointer_acceleration_profile_adaptive; | ||
61 | 112 | }; | ||
62 | 113 | |||
63 | 96 | auto convert_to_click_mode = [](std::string const& val) | 114 | auto convert_to_click_mode = [](std::string const& val) |
64 | 97 | { | 115 | { |
65 | 98 | if (val == touchpad_click_mode_finger_count) | 116 | if (val == touchpad_click_mode_finger_count) |
66 | @@ -107,6 +125,7 @@ | |||
67 | 107 | auto const options = server.get_options(); | 125 | auto const options = server.get_options(); |
68 | 108 | auto const input_config = std::make_shared<me::InputDeviceConfig>( | 126 | auto const input_config = std::make_shared<me::InputDeviceConfig>( |
69 | 109 | options->get<bool>(disable_while_typing_opt), | 127 | options->get<bool>(disable_while_typing_opt), |
70 | 128 | to_profile(options->get<std::string>(mouse_acceleration_profile_opt)), | ||
71 | 110 | clamp_to_range(options->get<double>(mouse_cursor_acceleration_bias_opt)), | 129 | clamp_to_range(options->get<double>(mouse_cursor_acceleration_bias_opt)), |
72 | 111 | options->get<double>(mouse_scroll_speed_scale_opt), | 130 | options->get<double>(mouse_scroll_speed_scale_opt), |
73 | 112 | clamp_to_range(options->get<double>(touchpad_cursor_acceleration_bias_opt)), | 131 | clamp_to_range(options->get<double>(touchpad_cursor_acceleration_bias_opt)), |
74 | @@ -122,13 +141,15 @@ | |||
75 | 122 | /// Demonstrate how to implement an InputDeviceObserver that identifies and configures input devices. | 141 | /// Demonstrate how to implement an InputDeviceObserver that identifies and configures input devices. |
76 | 123 | 142 | ||
77 | 124 | me::InputDeviceConfig::InputDeviceConfig(bool disable_while_typing, | 143 | me::InputDeviceConfig::InputDeviceConfig(bool disable_while_typing, |
78 | 144 | MirPointerAccelerationProfile mouse_profile, | ||
79 | 125 | double mouse_cursor_acceleration_bias, | 145 | double mouse_cursor_acceleration_bias, |
80 | 126 | double mouse_scroll_speed_scale, | 146 | double mouse_scroll_speed_scale, |
81 | 127 | double touchpad_cursor_acceleration_bias, | 147 | double touchpad_cursor_acceleration_bias, |
82 | 128 | double touchpad_scroll_speed_scale, | 148 | double touchpad_scroll_speed_scale, |
83 | 129 | MirTouchpadClickModes click_mode, | 149 | MirTouchpadClickModes click_mode, |
84 | 130 | MirTouchpadClickModes scroll_mode) | 150 | MirTouchpadClickModes scroll_mode) |
86 | 131 | : disable_while_typing(disable_while_typing), mouse_cursor_acceleration_bias(mouse_cursor_acceleration_bias), | 151 | : disable_while_typing(disable_while_typing), mouse_profile{mouse_profile}, |
87 | 152 | mouse_cursor_acceleration_bias(mouse_cursor_acceleration_bias), | ||
88 | 132 | mouse_scroll_speed_scale(mouse_scroll_speed_scale), | 153 | mouse_scroll_speed_scale(mouse_scroll_speed_scale), |
89 | 133 | touchpad_cursor_acceleration_bias(touchpad_cursor_acceleration_bias), | 154 | touchpad_cursor_acceleration_bias(touchpad_cursor_acceleration_bias), |
90 | 134 | touchpad_scroll_speed_scale(touchpad_scroll_speed_scale), click_mode(click_mode), scroll_mode(scroll_mode) | 155 | touchpad_scroll_speed_scale(touchpad_scroll_speed_scale), click_mode(click_mode), scroll_mode(scroll_mode) |
91 | @@ -154,6 +175,7 @@ | |||
92 | 154 | else if (contains(device->capabilities(), mi::DeviceCapability::pointer)) | 175 | else if (contains(device->capabilities(), mi::DeviceCapability::pointer)) |
93 | 155 | { | 176 | { |
94 | 156 | mi::PointerConfiguration pointer_config( device->pointer_configuration().value() ); | 177 | mi::PointerConfiguration pointer_config( device->pointer_configuration().value() ); |
95 | 178 | pointer_config.acceleration_profile = mouse_profile; | ||
96 | 157 | pointer_config.cursor_acceleration_bias = mouse_cursor_acceleration_bias; | 179 | pointer_config.cursor_acceleration_bias = mouse_cursor_acceleration_bias; |
97 | 158 | pointer_config.vertical_scroll_scale = mouse_scroll_speed_scale; | 180 | pointer_config.vertical_scroll_scale = mouse_scroll_speed_scale; |
98 | 159 | pointer_config.horizontal_scroll_scale = mouse_scroll_speed_scale; | 181 | pointer_config.horizontal_scroll_scale = mouse_scroll_speed_scale; |
99 | 160 | 182 | ||
100 | === modified file 'examples/server_example_input_device_config.h' | |||
101 | --- examples/server_example_input_device_config.h 2015-12-06 23:57:03 +0000 | |||
102 | +++ examples/server_example_input_device_config.h 2015-12-15 13:25:30 +0000 | |||
103 | @@ -33,20 +33,13 @@ | |||
104 | 33 | 33 | ||
105 | 34 | namespace examples | 34 | namespace examples |
106 | 35 | { | 35 | { |
107 | 36 | extern char const* const disable_while_typing_opt; | ||
108 | 37 | extern char const* const mouse_cursor_acceleration_bias_opt; | ||
109 | 38 | extern char const* const mouse_scroll_speed_scale_opt; | ||
110 | 39 | extern char const* const touchpad_cursor_acceleration_bias_opt; | ||
111 | 40 | extern char const* const touchpad_scroll_speed_scale_opt; | ||
112 | 41 | extern char const* const touchpad_click_mode_opt; | ||
113 | 42 | extern char const* const touchpad_scroll_mode_opt; | ||
114 | 43 | |||
115 | 44 | void add_input_device_configuration_options_to(Server& server); | 36 | void add_input_device_configuration_options_to(Server& server); |
116 | 45 | 37 | ||
117 | 46 | class InputDeviceConfig : public mir::input::InputDeviceObserver | 38 | class InputDeviceConfig : public mir::input::InputDeviceObserver |
118 | 47 | { | 39 | { |
119 | 48 | public: | 40 | public: |
120 | 49 | InputDeviceConfig(bool disable_while_typing, | 41 | InputDeviceConfig(bool disable_while_typing, |
121 | 42 | MirPointerAccelerationProfile mouse_profile, | ||
122 | 50 | double mouse_cursor_acceleration_bias, | 43 | double mouse_cursor_acceleration_bias, |
123 | 51 | double mouse_scroll_speed_scale, | 44 | double mouse_scroll_speed_scale, |
124 | 52 | double touchpad_cursor_acceleration_bias, | 45 | double touchpad_cursor_acceleration_bias, |
125 | @@ -59,6 +52,7 @@ | |||
126 | 59 | void changes_complete() override {} | 52 | void changes_complete() override {} |
127 | 60 | private: | 53 | private: |
128 | 61 | bool disable_while_typing; | 54 | bool disable_while_typing; |
129 | 55 | MirPointerAccelerationProfile mouse_profile; | ||
130 | 62 | double mouse_cursor_acceleration_bias; | 56 | double mouse_cursor_acceleration_bias; |
131 | 63 | double mouse_scroll_speed_scale; | 57 | double mouse_scroll_speed_scale; |
132 | 64 | double touchpad_cursor_acceleration_bias; | 58 | double touchpad_cursor_acceleration_bias; |
133 | 65 | 59 | ||
134 | === modified file 'include/client/mir_toolkit/mir_input_device.h' | |||
135 | --- include/client/mir_toolkit/mir_input_device.h 2015-10-26 03:33:22 +0000 | |||
136 | +++ include/client/mir_toolkit/mir_input_device.h 2015-12-15 13:25:30 +0000 | |||
137 | @@ -32,6 +32,13 @@ | |||
138 | 32 | mir_pointer_handedness_left = 1 | 32 | mir_pointer_handedness_left = 1 |
139 | 33 | } MirPointerHandedness; | 33 | } MirPointerHandedness; |
140 | 34 | 34 | ||
141 | 35 | typedef enum MirPointerAccelerationProfile | ||
142 | 36 | { | ||
143 | 37 | mir_pointer_acceleration_profile_none = 0, | ||
144 | 38 | mir_pointer_acceleration_profile_flat = 1, | ||
145 | 39 | mir_pointer_acceleration_profile_adaptive = 2 | ||
146 | 40 | } MirPointerAccelerationProfile; | ||
147 | 41 | |||
148 | 35 | typedef enum MirTouchpadClickMode | 42 | typedef enum MirTouchpadClickMode |
149 | 36 | { | 43 | { |
150 | 37 | mir_touchpad_click_mode_none = 0, | 44 | mir_touchpad_click_mode_none = 0, |
151 | 38 | 45 | ||
152 | === modified file 'include/platform/mir/input/pointer_settings.h' | |||
153 | --- include/platform/mir/input/pointer_settings.h 2015-10-26 03:33:22 +0000 | |||
154 | +++ include/platform/mir/input/pointer_settings.h 2015-12-15 13:25:30 +0000 | |||
155 | @@ -43,6 +43,10 @@ | |||
156 | 43 | */ | 43 | */ |
157 | 44 | double cursor_acceleration_bias{0.0}; | 44 | double cursor_acceleration_bias{0.0}; |
158 | 45 | /** | 45 | /** |
159 | 46 | * Acceleration profile | ||
160 | 47 | */ | ||
161 | 48 | MirPointerAccelerationProfile acceleration_profile{mir_pointer_acceleration_profile_adaptive}; | ||
162 | 49 | /** | ||
163 | 46 | * Scale horizontal scrolling linearly | 50 | * Scale horizontal scrolling linearly |
164 | 47 | */ | 51 | */ |
165 | 48 | double horizontal_scroll_scale{1.0}; | 52 | double horizontal_scroll_scale{1.0}; |
166 | 49 | 53 | ||
167 | === modified file 'include/server/mir/input/pointer_configuration.h' | |||
168 | --- include/server/mir/input/pointer_configuration.h 2015-11-04 16:30:42 +0000 | |||
169 | +++ include/server/mir/input/pointer_configuration.h 2015-12-15 13:25:30 +0000 | |||
170 | @@ -33,10 +33,11 @@ | |||
171 | 33 | { | 33 | { |
172 | 34 | PointerConfiguration() {} | 34 | PointerConfiguration() {} |
173 | 35 | 35 | ||
178 | 36 | PointerConfiguration(MirPointerHandedness handedness, double acceleration_bias, double horizontal_scroll_scale, | 36 | PointerConfiguration(MirPointerHandedness handedness, MirPointerAccelerationProfile acceleration_profile, double acceleration_bias, |
179 | 37 | double vertical_scroll_scale) | 37 | double horizontal_scroll_scale, double vertical_scroll_scale) |
180 | 38 | : handedness{handedness}, cursor_acceleration_bias{acceleration_bias}, | 38 | : handedness{handedness}, acceleration_profile{acceleration_profile}, |
181 | 39 | horizontal_scroll_scale{horizontal_scroll_scale}, vertical_scroll_scale{vertical_scroll_scale} | 39 | cursor_acceleration_bias{acceleration_bias}, horizontal_scroll_scale{horizontal_scroll_scale}, |
182 | 40 | vertical_scroll_scale{vertical_scroll_scale} | ||
183 | 40 | { | 41 | { |
184 | 41 | } | 42 | } |
185 | 42 | 43 | ||
186 | @@ -47,6 +48,11 @@ | |||
187 | 47 | MirPointerHandedness handedness{mir_pointer_handedness_right}; | 48 | MirPointerHandedness handedness{mir_pointer_handedness_right}; |
188 | 48 | 49 | ||
189 | 49 | /*! | 50 | /*! |
190 | 51 | * Configure cursor acceleration profile | ||
191 | 52 | */ | ||
192 | 53 | MirPointerAccelerationProfile acceleration_profile{mir_pointer_acceleration_profile_adaptive}; | ||
193 | 54 | |||
194 | 55 | /*! | ||
195 | 50 | * Configures the intensity of the cursor acceleration. Values within the range of [-1, 1] are allowed. | 56 | * Configures the intensity of the cursor acceleration. Values within the range of [-1, 1] are allowed. |
196 | 51 | * - 0: default acceleration | 57 | * - 0: default acceleration |
197 | 52 | * - [-1, 0): reduced acceleration | 58 | * - [-1, 0): reduced acceleration |
198 | 53 | 59 | ||
199 | === modified file 'src/platforms/evdev/libinput_device.cpp' | |||
200 | --- src/platforms/evdev/libinput_device.cpp 2015-12-07 01:13:18 +0000 | |||
201 | +++ src/platforms/evdev/libinput_device.cpp 2015-12-15 13:25:30 +0000 | |||
202 | @@ -167,9 +167,8 @@ | |||
203 | 167 | 167 | ||
204 | 168 | report->received_event_from_kernel(time.count(), EV_REL, 0, 0); | 168 | report->received_event_from_kernel(time.count(), EV_REL, 0, 0); |
205 | 169 | 169 | ||
209 | 170 | mir::geometry::Displacement const movement{ | 170 | mir::geometry::Displacement const movement{libinput_event_pointer_get_dx(pointer), |
210 | 171 | libinput_event_pointer_get_dx(pointer), | 171 | libinput_event_pointer_get_dy(pointer)}; |
208 | 172 | libinput_event_pointer_get_dy(pointer)}; | ||
211 | 173 | 172 | ||
212 | 174 | return builder->pointer_event(time, action, button_state, hscroll_value, vscroll_value, movement.dx.as_float(), | 173 | return builder->pointer_event(time, action, button_state, hscroll_value, vscroll_value, movement.dx.as_float(), |
213 | 175 | movement.dy.as_float()); | 174 | movement.dy.as_float()); |
214 | @@ -336,15 +335,26 @@ | |||
215 | 336 | if (!contains(info.capabilities, mi::DeviceCapability::pointer)) | 335 | if (!contains(info.capabilities, mi::DeviceCapability::pointer)) |
216 | 337 | return {}; | 336 | return {}; |
217 | 338 | 337 | ||
218 | 339 | auto dev = device(); | ||
219 | 340 | auto accel_bias = libinput_device_config_accel_get_speed(dev); | ||
220 | 341 | auto left_handed = (libinput_device_config_left_handed_get(dev) == 1); | ||
221 | 342 | |||
222 | 343 | mi::PointerSettings settings; | 338 | mi::PointerSettings settings; |
224 | 344 | settings.cursor_acceleration_bias = accel_bias; | 339 | auto dev = device(); |
225 | 340 | auto const left_handed = (libinput_device_config_left_handed_get(dev) == 1); | ||
226 | 341 | settings.handedness = left_handed? mir_pointer_handedness_left : mir_pointer_handedness_right; | ||
227 | 342 | switch(libinput_device_config_accel_get_profile(dev)) | ||
228 | 343 | { | ||
229 | 344 | case LIBINPUT_CONFIG_ACCEL_PROFILE_NONE: | ||
230 | 345 | settings.acceleration_profile = mir_pointer_acceleration_profile_none; | ||
231 | 346 | break; | ||
232 | 347 | case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT: | ||
233 | 348 | settings.acceleration_profile = mir_pointer_acceleration_profile_flat; | ||
234 | 349 | break; | ||
235 | 350 | case LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE: | ||
236 | 351 | settings.acceleration_profile = mir_pointer_acceleration_profile_adaptive; | ||
237 | 352 | break; | ||
238 | 353 | } | ||
239 | 354 | |||
240 | 355 | settings.cursor_acceleration_bias = libinput_device_config_accel_get_speed(dev); | ||
241 | 345 | settings.vertical_scroll_scale = vertical_scroll_scale; | 356 | settings.vertical_scroll_scale = vertical_scroll_scale; |
242 | 346 | settings.horizontal_scroll_scale = horizontal_scroll_scale; | 357 | settings.horizontal_scroll_scale = horizontal_scroll_scale; |
243 | 347 | settings.handedness = left_handed? mir_pointer_handedness_left : mir_pointer_handedness_right; | ||
244 | 348 | return settings; | 358 | return settings; |
245 | 349 | } | 359 | } |
246 | 350 | 360 | ||
247 | @@ -358,6 +368,13 @@ | |||
248 | 358 | libinput_device_config_left_handed_set(dev, mir_pointer_handedness_left == settings.handedness); | 368 | libinput_device_config_left_handed_set(dev, mir_pointer_handedness_left == settings.handedness); |
249 | 359 | vertical_scroll_scale = settings.vertical_scroll_scale; | 369 | vertical_scroll_scale = settings.vertical_scroll_scale; |
250 | 360 | horizontal_scroll_scale = settings.horizontal_scroll_scale; | 370 | horizontal_scroll_scale = settings.horizontal_scroll_scale; |
251 | 371 | libinput_device_config_accel_set_profile( | ||
252 | 372 | dev, | ||
253 | 373 | (settings.acceleration_profile == mir_pointer_acceleration_profile_none) ? | ||
254 | 374 | LIBINPUT_CONFIG_ACCEL_PROFILE_NONE : | ||
255 | 375 | (settings.acceleration_profile == mir_pointer_acceleration_profile_flat) ? | ||
256 | 376 | LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT : | ||
257 | 377 | LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); | ||
258 | 361 | } | 378 | } |
259 | 362 | 379 | ||
260 | 363 | mir::optional_value<mi::TouchpadSettings> mie::LibInputDevice::get_touchpad_settings() const | 380 | mir::optional_value<mi::TouchpadSettings> mie::LibInputDevice::get_touchpad_settings() const |
261 | 364 | 381 | ||
262 | === modified file 'src/platforms/evdev/libinput_device.h' | |||
263 | --- src/platforms/evdev/libinput_device.h 2015-11-30 16:34:46 +0000 | |||
264 | +++ src/platforms/evdev/libinput_device.h 2015-12-15 13:25:30 +0000 | |||
265 | @@ -88,6 +88,7 @@ | |||
266 | 88 | InputDeviceInfo info; | 88 | InputDeviceInfo info; |
267 | 89 | mir::geometry::Point pointer_pos; | 89 | mir::geometry::Point pointer_pos; |
268 | 90 | MirPointerButtons button_state; | 90 | MirPointerButtons button_state; |
269 | 91 | bool enable_cursor_acceleration{true}; | ||
270 | 91 | double vertical_scroll_scale{1.0}; | 92 | double vertical_scroll_scale{1.0}; |
271 | 92 | double horizontal_scroll_scale{1.0}; | 93 | double horizontal_scroll_scale{1.0}; |
272 | 93 | 94 | ||
273 | 94 | 95 | ||
274 | === modified file 'src/server/input/default_device.cpp' | |||
275 | --- src/server/input/default_device.cpp 2015-11-04 19:47:19 +0000 | |||
276 | +++ src/server/input/default_device.cpp 2015-12-15 13:25:30 +0000 | |||
277 | @@ -62,8 +62,9 @@ | |||
278 | 62 | 62 | ||
279 | 63 | auto const& settings = pointer.value(); | 63 | auto const& settings = pointer.value(); |
280 | 64 | 64 | ||
283 | 65 | return PointerConfiguration(settings.handedness, settings.cursor_acceleration_bias, | 65 | return PointerConfiguration(settings.handedness, settings.acceleration_profile, |
284 | 66 | settings.horizontal_scroll_scale, settings.vertical_scroll_scale); | 66 | settings.cursor_acceleration_bias, settings.horizontal_scroll_scale, |
285 | 67 | settings.vertical_scroll_scale); | ||
286 | 67 | } | 68 | } |
287 | 68 | 69 | ||
288 | 69 | mir::optional_value<mi::TouchpadConfiguration> mi::DefaultDevice::touchpad_configuration() const | 70 | mir::optional_value<mi::TouchpadConfiguration> mi::DefaultDevice::touchpad_configuration() const |
289 | @@ -88,6 +89,7 @@ | |||
290 | 88 | 89 | ||
291 | 89 | PointerSettings settings; | 90 | PointerSettings settings; |
292 | 90 | settings.handedness = conf.handedness; | 91 | settings.handedness = conf.handedness; |
293 | 92 | settings.acceleration_profile = conf.acceleration_profile; | ||
294 | 91 | settings.cursor_acceleration_bias = conf.cursor_acceleration_bias; | 93 | settings.cursor_acceleration_bias = conf.cursor_acceleration_bias; |
295 | 92 | settings.vertical_scroll_scale = conf.vertical_scroll_scale; | 94 | settings.vertical_scroll_scale = conf.vertical_scroll_scale; |
296 | 93 | settings.horizontal_scroll_scale = conf.horizontal_scroll_scale; | 95 | settings.horizontal_scroll_scale = conf.horizontal_scroll_scale; |
297 | 94 | 96 | ||
298 | === modified file 'tests/include/mir/test/doubles/mock_libinput.h' | |||
299 | --- tests/include/mir/test/doubles/mock_libinput.h 2015-12-07 01:13:18 +0000 | |||
300 | +++ tests/include/mir/test/doubles/mock_libinput.h 2015-12-15 13:25:30 +0000 | |||
301 | @@ -121,6 +121,8 @@ | |||
302 | 121 | MOCK_METHOD2(libinput_device_config_accel_set_speed, libinput_config_status(libinput_device*, double speed)); | 121 | MOCK_METHOD2(libinput_device_config_accel_set_speed, libinput_config_status(libinput_device*, double speed)); |
303 | 122 | MOCK_METHOD1(libinput_device_config_accel_get_speed, double(libinput_device*)); | 122 | MOCK_METHOD1(libinput_device_config_accel_get_speed, double(libinput_device*)); |
304 | 123 | MOCK_METHOD1(libinput_device_config_accel_get_default_speed, double(libinput_device*)); | 123 | MOCK_METHOD1(libinput_device_config_accel_get_default_speed, double(libinput_device*)); |
305 | 124 | MOCK_METHOD2(libinput_device_config_accel_set_profile, libinput_config_status(libinput_device*, libinput_config_accel_profile)); | ||
306 | 125 | MOCK_METHOD1(libinput_device_config_accel_get_profile, libinput_config_accel_profile(libinput_device*)); | ||
307 | 124 | MOCK_METHOD1(libinput_device_config_scroll_has_natural_scroll, int(libinput_device*)); | 126 | MOCK_METHOD1(libinput_device_config_scroll_has_natural_scroll, int(libinput_device*)); |
308 | 125 | MOCK_METHOD2(libinput_device_config_scroll_set_natural_scroll_enabled, libinput_config_status(libinput_device*, int enable)); | 127 | MOCK_METHOD2(libinput_device_config_scroll_set_natural_scroll_enabled, libinput_config_status(libinput_device*, int enable)); |
309 | 126 | MOCK_METHOD1(libinput_device_config_scroll_get_natural_scroll_enabled, int(libinput_device*)); | 128 | MOCK_METHOD1(libinput_device_config_scroll_get_natural_scroll_enabled, int(libinput_device*)); |
310 | 127 | 129 | ||
311 | === modified file 'tests/mir_test_doubles/mock_libinput.cpp' | |||
312 | --- tests/mir_test_doubles/mock_libinput.cpp 2015-12-07 01:13:18 +0000 | |||
313 | +++ tests/mir_test_doubles/mock_libinput.cpp 2015-12-15 13:25:30 +0000 | |||
314 | @@ -51,6 +51,8 @@ | |||
315 | 51 | .WillByDefault(Return(LIBINPUT_CONFIG_STATUS_SUCCESS)); | 51 | .WillByDefault(Return(LIBINPUT_CONFIG_STATUS_SUCCESS)); |
316 | 52 | ON_CALL(*this, libinput_device_config_middle_emulation_set_enabled(_, _)) | 52 | ON_CALL(*this, libinput_device_config_middle_emulation_set_enabled(_, _)) |
317 | 53 | .WillByDefault(Return(LIBINPUT_CONFIG_STATUS_SUCCESS)); | 53 | .WillByDefault(Return(LIBINPUT_CONFIG_STATUS_SUCCESS)); |
318 | 54 | ON_CALL(*this, libinput_device_config_accel_set_profile(_, _)) | ||
319 | 55 | .WillByDefault(Return(LIBINPUT_CONFIG_STATUS_SUCCESS)); | ||
320 | 54 | } | 56 | } |
321 | 55 | 57 | ||
322 | 56 | void mtd::MockLibInput::wake() | 58 | void mtd::MockLibInput::wake() |
323 | @@ -458,6 +460,16 @@ | |||
324 | 458 | return global_libinput->libinput_device_config_accel_get_default_speed(device); | 460 | return global_libinput->libinput_device_config_accel_get_default_speed(device); |
325 | 459 | } | 461 | } |
326 | 460 | 462 | ||
327 | 463 | libinput_config_status libinput_device_config_accel_set_profile(libinput_device* dev, libinput_config_accel_profile profile) | ||
328 | 464 | { | ||
329 | 465 | return global_libinput->libinput_device_config_accel_set_profile(dev, profile); | ||
330 | 466 | } | ||
331 | 467 | |||
332 | 468 | libinput_config_accel_profile libinput_device_config_accel_get_profile(libinput_device* dev) | ||
333 | 469 | { | ||
334 | 470 | return global_libinput->libinput_device_config_accel_get_profile(dev); | ||
335 | 471 | } | ||
336 | 472 | |||
337 | 461 | int libinput_device_config_scroll_has_natural_scroll(libinput_device *device) | 473 | int libinput_device_config_scroll_has_natural_scroll(libinput_device *device) |
338 | 462 | { | 474 | { |
339 | 463 | return global_libinput->libinput_device_config_scroll_has_natural_scroll(device); | 475 | return global_libinput->libinput_device_config_scroll_has_natural_scroll(device); |
340 | 464 | 476 | ||
341 | === modified file 'tests/mir_test_framework/fake_input_device_impl.cpp' | |||
342 | --- tests/mir_test_framework/fake_input_device_impl.cpp 2015-11-25 20:26:59 +0000 | |||
343 | +++ tests/mir_test_framework/fake_input_device_impl.cpp 2015-12-15 13:25:30 +0000 | |||
344 | @@ -90,6 +90,7 @@ | |||
345 | 90 | std::shared_ptr<mir::dispatch::Dispatchable> const& dispatchable) | 90 | std::shared_ptr<mir::dispatch::Dispatchable> const& dispatchable) |
346 | 91 | : info(info), queue{dispatchable}, buttons{0} | 91 | : info(info), queue{dispatchable}, buttons{0} |
347 | 92 | { | 92 | { |
348 | 93 | settings.acceleration_profile = mir_pointer_acceleration_profile_none; | ||
349 | 93 | } | 94 | } |
350 | 94 | 95 | ||
351 | 95 | void mtf::FakeInputDeviceImpl::InputDevice::synthesize_events(synthesis::KeyParameters const& key_params) | 96 | void mtf::FakeInputDeviceImpl::InputDevice::synthesize_events(synthesis::KeyParameters const& key_params) |
352 | @@ -151,9 +152,11 @@ | |||
353 | 151 | // constant scaling is used here to simplify checking for the | 152 | // constant scaling is used here to simplify checking for the |
354 | 152 | // expected results. Default settings of the device lead to no | 153 | // expected results. Default settings of the device lead to no |
355 | 153 | // scaling at all. | 154 | // scaling at all. |
359 | 154 | auto acceleration = (settings.cursor_acceleration_bias + 1.0); | 155 | auto const acceleration = settings.acceleration_profile == mir_pointer_acceleration_profile_flat ? |
360 | 155 | auto rel_x = pointer.rel_x * acceleration; | 156 | (settings.cursor_acceleration_bias + 1.0) : |
361 | 156 | auto rel_y = pointer.rel_y * acceleration; | 157 | 1.0; |
362 | 158 | auto const rel_x = pointer.rel_x * acceleration; | ||
363 | 159 | auto const rel_y = pointer.rel_y * acceleration; | ||
364 | 157 | 160 | ||
365 | 158 | auto pointer_event = builder->pointer_event(event_time, | 161 | auto pointer_event = builder->pointer_event(event_time, |
366 | 159 | mir_pointer_action_motion, | 162 | mir_pointer_action_motion, |
367 | @@ -213,7 +216,7 @@ | |||
368 | 213 | if (!contains(info.capabilities, mi::DeviceCapability::pointer)) | 216 | if (!contains(info.capabilities, mi::DeviceCapability::pointer)) |
369 | 214 | return ret; | 217 | return ret; |
370 | 215 | 218 | ||
372 | 216 | ret = mi::PointerSettings(); | 219 | ret = settings; |
373 | 217 | return ret; | 220 | return ret; |
374 | 218 | } | 221 | } |
375 | 219 | 222 | ||
376 | 220 | 223 | ||
377 | === modified file 'tests/unit-tests/input/evdev/test_libinput_device.cpp' | |||
378 | --- tests/unit-tests/input/evdev/test_libinput_device.cpp 2015-12-07 01:13:18 +0000 | |||
379 | +++ tests/unit-tests/input/evdev/test_libinput_device.cpp 2015-12-15 13:25:30 +0000 | |||
380 | @@ -208,12 +208,18 @@ | |||
381 | 208 | return device_path; | 208 | return device_path; |
382 | 209 | } | 209 | } |
383 | 210 | 210 | ||
385 | 211 | void setup_pointer_configuration(libinput_device* dev, double accel_speed, MirPointerHandedness handedness) | 211 | void setup_pointer_configuration(libinput_device* dev, double accel_speed, MirPointerHandedness handedness, MirPointerAccelerationProfile profile) |
386 | 212 | { | 212 | { |
387 | 213 | ON_CALL(mock_libinput, libinput_device_config_accel_get_speed(dev)) | 213 | ON_CALL(mock_libinput, libinput_device_config_accel_get_speed(dev)) |
388 | 214 | .WillByDefault(Return(accel_speed)); | 214 | .WillByDefault(Return(accel_speed)); |
389 | 215 | ON_CALL(mock_libinput, libinput_device_config_left_handed_get(dev)) | 215 | ON_CALL(mock_libinput, libinput_device_config_left_handed_get(dev)) |
390 | 216 | .WillByDefault(Return(handedness == mir_pointer_handedness_left)); | 216 | .WillByDefault(Return(handedness == mir_pointer_handedness_left)); |
391 | 217 | ON_CALL(mock_libinput, libinput_device_config_accel_get_profile(dev)) | ||
392 | 218 | .WillByDefault(Return((profile == mir_pointer_acceleration_profile_flat) ? | ||
393 | 219 | LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT : | ||
394 | 220 | (profile == mir_pointer_acceleration_profile_none) ? | ||
395 | 221 | LIBINPUT_CONFIG_ACCEL_PROFILE_NONE : | ||
396 | 222 | LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)); | ||
397 | 217 | } | 223 | } |
398 | 218 | 224 | ||
399 | 219 | void setup_touchpad_configuration(libinput_device* dev, | 225 | void setup_touchpad_configuration(libinput_device* dev, |
400 | @@ -779,7 +785,7 @@ | |||
401 | 779 | 785 | ||
402 | 780 | TEST_F(LibInputDeviceOnMouse, reads_pointer_settings_from_libinput) | 786 | TEST_F(LibInputDeviceOnMouse, reads_pointer_settings_from_libinput) |
403 | 781 | { | 787 | { |
405 | 782 | setup_pointer_configuration(mouse.device(), 1, mir_pointer_handedness_right); | 788 | setup_pointer_configuration(mouse.device(), 1, mir_pointer_handedness_right, mir_pointer_acceleration_profile_flat); |
406 | 783 | auto optional_settings = mouse.get_pointer_settings(); | 789 | auto optional_settings = mouse.get_pointer_settings(); |
407 | 784 | 790 | ||
408 | 785 | EXPECT_THAT(optional_settings.is_set(), Eq(true)); | 791 | EXPECT_THAT(optional_settings.is_set(), Eq(true)); |
409 | @@ -789,8 +795,9 @@ | |||
410 | 789 | EXPECT_THAT(ptr_settings.cursor_acceleration_bias, Eq(1.0)); | 795 | EXPECT_THAT(ptr_settings.cursor_acceleration_bias, Eq(1.0)); |
411 | 790 | EXPECT_THAT(ptr_settings.horizontal_scroll_scale, Eq(1.0)); | 796 | EXPECT_THAT(ptr_settings.horizontal_scroll_scale, Eq(1.0)); |
412 | 791 | EXPECT_THAT(ptr_settings.vertical_scroll_scale, Eq(1.0)); | 797 | EXPECT_THAT(ptr_settings.vertical_scroll_scale, Eq(1.0)); |
413 | 798 | EXPECT_THAT(ptr_settings.acceleration_profile, Eq(mir_pointer_acceleration_profile_flat)); | ||
414 | 792 | 799 | ||
416 | 793 | setup_pointer_configuration(mouse.device(), 0.0, mir_pointer_handedness_left); | 800 | setup_pointer_configuration(mouse.device(), 0.0, mir_pointer_handedness_left, mir_pointer_acceleration_profile_adaptive); |
417 | 794 | optional_settings = mouse.get_pointer_settings(); | 801 | optional_settings = mouse.get_pointer_settings(); |
418 | 795 | 802 | ||
419 | 796 | EXPECT_THAT(optional_settings.is_set(), Eq(true)); | 803 | EXPECT_THAT(optional_settings.is_set(), Eq(true)); |
420 | @@ -800,23 +807,27 @@ | |||
421 | 800 | EXPECT_THAT(ptr_settings.cursor_acceleration_bias, Eq(0.0)); | 807 | EXPECT_THAT(ptr_settings.cursor_acceleration_bias, Eq(0.0)); |
422 | 801 | EXPECT_THAT(ptr_settings.horizontal_scroll_scale, Eq(1.0)); | 808 | EXPECT_THAT(ptr_settings.horizontal_scroll_scale, Eq(1.0)); |
423 | 802 | EXPECT_THAT(ptr_settings.vertical_scroll_scale, Eq(1.0)); | 809 | EXPECT_THAT(ptr_settings.vertical_scroll_scale, Eq(1.0)); |
424 | 810 | EXPECT_THAT(ptr_settings.acceleration_profile, Eq(mir_pointer_acceleration_profile_adaptive)); | ||
425 | 803 | } | 811 | } |
426 | 804 | 812 | ||
427 | 805 | TEST_F(LibInputDeviceOnMouse, applies_pointer_settings) | 813 | TEST_F(LibInputDeviceOnMouse, applies_pointer_settings) |
428 | 806 | { | 814 | { |
430 | 807 | setup_pointer_configuration(mouse.device(), 1, mir_pointer_handedness_right); | 815 | setup_pointer_configuration(mouse.device(), 1, mir_pointer_handedness_right, mir_pointer_acceleration_profile_none); |
431 | 808 | mi::PointerSettings settings(mouse.get_pointer_settings().value()); | 816 | mi::PointerSettings settings(mouse.get_pointer_settings().value()); |
432 | 809 | settings.cursor_acceleration_bias = 1.1; | 817 | settings.cursor_acceleration_bias = 1.1; |
433 | 810 | settings.handedness = mir_pointer_handedness_left; | 818 | settings.handedness = mir_pointer_handedness_left; |
434 | 819 | settings.acceleration_profile = mir_pointer_acceleration_profile_flat; | ||
435 | 811 | 820 | ||
438 | 812 | EXPECT_CALL(mock_libinput,libinput_device_config_accel_set_speed(mouse.device(), 1.1)).Times(1); | 821 | EXPECT_CALL(mock_libinput, libinput_device_config_accel_set_speed(mouse.device(), 1.1)).Times(1); |
439 | 813 | EXPECT_CALL(mock_libinput,libinput_device_config_left_handed_set(mouse.device(), true)).Times(1); | 822 | EXPECT_CALL(mock_libinput, libinput_device_config_accel_set_profile(mouse.device(), LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT)).Times(1); |
440 | 823 | EXPECT_CALL(mock_libinput, libinput_device_config_left_handed_set(mouse.device(), true)).Times(1); | ||
441 | 814 | 824 | ||
442 | 815 | mouse.apply_settings(settings); | 825 | mouse.apply_settings(settings); |
443 | 816 | } | 826 | } |
444 | 817 | 827 | ||
445 | 818 | TEST_F(LibInputDeviceOnLaptopKeyboardAndMouse, denies_pointer_settings_on_keyboards) | 828 | TEST_F(LibInputDeviceOnLaptopKeyboardAndMouse, denies_pointer_settings_on_keyboards) |
446 | 819 | { | 829 | { |
447 | 830 | setup_pointer_configuration(mouse.device(), 1, mir_pointer_handedness_right, mir_pointer_acceleration_profile_none); | ||
448 | 820 | auto settings_from_mouse = mouse.get_pointer_settings(); | 831 | auto settings_from_mouse = mouse.get_pointer_settings(); |
449 | 821 | 832 | ||
450 | 822 | EXPECT_CALL(mock_libinput,libinput_device_config_accel_set_speed(_, _)).Times(0); | 833 | EXPECT_CALL(mock_libinput,libinput_device_config_accel_set_speed(_, _)).Times(0); |
451 | @@ -834,7 +845,7 @@ | |||
452 | 834 | EXPECT_CALL(mock_sink, handle_input(mt::PointerAxisChange(mir_pointer_axis_vscroll, 3.0f))); | 845 | EXPECT_CALL(mock_sink, handle_input(mt::PointerAxisChange(mir_pointer_axis_vscroll, 3.0f))); |
453 | 835 | EXPECT_CALL(mock_sink, handle_input(mt::PointerAxisChange(mir_pointer_axis_hscroll, -10.0f))); | 846 | EXPECT_CALL(mock_sink, handle_input(mt::PointerAxisChange(mir_pointer_axis_hscroll, -10.0f))); |
454 | 836 | 847 | ||
456 | 837 | setup_pointer_configuration(mouse.device(), 1, mir_pointer_handedness_right); | 848 | setup_pointer_configuration(mouse.device(), 1, mir_pointer_handedness_right, mir_pointer_acceleration_profile_flat); |
457 | 838 | mi::PointerSettings settings(mouse.get_pointer_settings().value()); | 849 | mi::PointerSettings settings(mouse.get_pointer_settings().value()); |
458 | 839 | settings.vertical_scroll_scale = -1.0; | 850 | settings.vertical_scroll_scale = -1.0; |
459 | 840 | settings.horizontal_scroll_scale = 5.0; | 851 | settings.horizontal_scroll_scale = 5.0; |
PASSED: Continuous integration, rev:3192 jenkins. qa.ubuntu. com/job/ mir-ci/ 5847/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/5309 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/4215 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/5258 jenkins. qa.ubuntu. com/job/ mir-mediumtests -xenial- touch/157/ console jenkins. qa.ubuntu. com/job/ mir-xenial- amd64-ci/ 175 jenkins. qa.ubuntu. com/job/ mir-xenial- amd64-ci/ 175/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-xenial- i386-ci/ 175 jenkins. qa.ubuntu. com/job/ mir-xenial- i386-ci/ 175/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 5258 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 5258/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- touch/7778 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 26049 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- xenial- armhf/155 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- xenial- armhf/155/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- xenial- touch/14/ console s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 26052
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/5847/ rebuild
http://