@@ -229,6 +229,23 @@ static bool set_calibration_matrix(struct libinput_device *dev, float mat[6]) {
229
229
return changed ;
230
230
}
231
231
232
+ #if HAVE_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM
233
+ static bool set_pointer_accel_custom (struct libinput_device * dev , struct accel_custom * custom ) {
234
+ sway_log (SWAY_DEBUG , "pointer_accel_config(npoints %lu, step %f)" , custom -> npoints , custom -> step );
235
+ if (custom -> npoints == 0 ) {
236
+ return false;
237
+ }
238
+ struct libinput_config_accel * accel_config =
239
+ libinput_config_accel_create (LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM );
240
+ log_status (libinput_config_accel_set_points (accel_config , LIBINPUT_ACCEL_TYPE_MOTION ,
241
+ custom -> step , custom -> npoints , custom -> points ));
242
+ log_status (libinput_device_config_accel_apply (dev , accel_config ));
243
+ libinput_config_accel_destroy (accel_config );
244
+ /* there is no way to read back the custom points/step from libinput */
245
+ return false;
246
+ }
247
+ #endif
248
+
232
249
static bool configure_send_events (struct libinput_device * device ,
233
250
struct input_config * ic ) {
234
251
if (ic -> mapped_to_output &&
@@ -285,6 +302,11 @@ bool sway_input_configure_libinput_device(struct sway_input_device *input_device
285
302
}
286
303
if (ic -> accel_profile != INT_MIN ) {
287
304
changed |= set_accel_profile (device , ic -> accel_profile );
305
+ #if HAVE_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM
306
+ if (ic -> accel_profile == LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM ) {
307
+ set_pointer_accel_custom (device , & ic -> pointer_accel_custom );
308
+ }
309
+ #endif
288
310
}
289
311
if (ic -> natural_scroll != INT_MIN ) {
290
312
changed |= set_natural_scroll (device , ic -> natural_scroll );
0 commit comments