-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpointing_device_accel.h
87 lines (73 loc) · 3.28 KB
/
pointing_device_accel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright 2024 burkfers (@burkfers)
// Copyright 2024 Wimads (@wimads)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "action.h"
#include "report.h"
// lower/higher value = curve starts more smoothly/abruptly
#ifndef POINTING_DEVICE_ACCEL_TAKEOFF
# define POINTING_DEVICE_ACCEL_TAKEOFF 2.0
#endif // POINTING_DEVICE_ACCEL_TAKEOFF
// lower/higher value = curve reaches its upper limit slower/faster
#ifndef POINTING_DEVICE_ACCEL_GROWTH_RATE
# define POINTING_DEVICE_ACCEL_GROWTH_RATE 0.25
#endif // POINTING_DEVICE_ACCEL_GROWTH_RATE
// lower/higher value = acceleration kicks in earlier/later
#ifndef POINTING_DEVICE_ACCEL_OFFSET
# define POINTING_DEVICE_ACCEL_OFFSET 2.2
#endif // POINTING_DEVICE_ACCEL_OFFSET
// lower limit of accel curve (minimum acceleration factor)
#ifndef POINTING_DEVICE_ACCEL_LIMIT
# define POINTING_DEVICE_ACCEL_LIMIT 0.2
#endif // POINTING_DEVICE_ACCEL_LIMIT
// milliseconds to wait between requesting the device's current DPI
#ifndef POINTING_DEVICE_ACCEL_CPI_THROTTLE_MS
# define POINTING_DEVICE_ACCEL_CPI_THROTTLE_MS 200
#endif // POINTING_DEVICE_ACCEL_CPI_THROTTLE_MS
// upper limit of accel curve, recommended to leave at 1; adjust DPI setting instead.
#ifndef POINTING_DEVICE_ACCEL_LIMIT_UPPER
# define POINTING_DEVICE_ACCEL_LIMIT_UPPER 1
#endif // POINTING_DEVICE_ACCEL_LIMIT_UPPER
// milliseconds after which to reset quantization error correction (forget rounding remainder)
#ifndef POINTING_DEVICE_ACCEL_ROUNDING_CARRY_TIMEOUT_MS
# define POINTING_DEVICE_ACCEL_ROUNDING_CARRY_TIMEOUT_MS 200
#endif // POINTING_DEVICE_ACCEL_ROUNDING_CARRY_TIMEOUT_MS
#ifndef POINTING_DEVICE_ACCEL_TAKEOFF_STEP
# define POINTING_DEVICE_ACCEL_TAKEOFF_STEP 0.01f
#endif
#ifndef POINTING_DEVICE_ACCEL_GROWTH_RATE_STEP
# define POINTING_DEVICE_ACCEL_GROWTH_RATE_STEP 0.01f
#endif
#ifndef POINTING_DEVICE_ACCEL_OFFSET_STEP
# define POINTING_DEVICE_ACCEL_OFFSET_STEP 0.1f
#endif
#ifndef POINTING_DEVICE_ACCEL_LIMIT_STEP
# define POINTING_DEVICE_ACCEL_LIMIT_STEP 0.01f
#endif
typedef struct pointing_device_accel_config_t {
bool enabled : 1;
float growth_rate;
float offset;
float limit;
float takeoff;
} pointing_device_accel_config_t;
extern pointing_device_accel_config_t g_pointing_device_accel_config;
report_mouse_t pointing_device_task_pointing_device_accel(report_mouse_t mouse_report);
float pointing_device_accel_get_mod_step(float step);
void pointing_device_accel_enabled(bool enable);
bool pointing_device_accel_get_enabled(void);
void pointing_device_accel_toggle_enabled(void);
float pointing_device_accel_get_takeoff(void);
void pointing_device_accel_set_takeoff(float val);
void pointing_device_accel_takeoff_increment(void);
float pointing_device_accel_get_growth_rate(void);
void pointing_device_accel_set_growth_rate(float val);
void pointing_device_accel_growth_rate_increment(void);
float pointing_device_accel_get_offset(void);
void pointing_device_accel_set_offset(float val);
void pointing_device_accel_offset_increment(void);
float pointing_device_accel_get_limit(void);
void pointing_device_accel_set_limit(float val);
void pointing_device_accel_set_limit_increment(void);
void pointing_device_config_update(pointing_device_accel_config_t *config);
void pointing_device_config_read(pointing_device_accel_config_t *config);