pointing devices - fixed scrolling threshold for dual pointing like ximi
This commit is contained in:
parent
33818ac694
commit
b278f1a248
|
|
@ -183,7 +183,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|||
| `FP_POINTING_MIN_DPI` | (Required) Sets the minimum DPI for your pointing device | `2` |
|
||||
| `FP_POINTING_MAX_DPI` | (Required) Sets the maximum DPI for your pointing device | `60` |
|
||||
| `FP_POINTING_SCROLLING_DPI` | (Required) Sets the default DPI for scrolling | `2` |
|
||||
| `FP_POINTING_SCROLLING_THRESHOLD` | (Required) Sets the number of 'ticks' to trigger a single scroll | `6` |
|
||||
| `FP_POINTING_SCROLLING_THRESHOLD` | (Required) Sets the number of 'ticks' to trigger a single scroll | `10` |
|
||||
| `FP_POINTING_SCROLLING_X_REVERSED` | (Required) Reverses the direction of X scrolling | `undefined` |
|
||||
| `FP_POINTING_SCROLLING_Y_REVERSED` | (Required) Reverses the direction of Y scrolling | `undefined` |
|
||||
| `FP_POINTING_SCROLLING_MIN_DPI` | (Required) Sets the minimum DPI for scrolling | `2` |
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ void fp_apply_dpi_defaults(void) {
|
|||
if (FP_POINTING_COMBINED_SNIPING_RIGHT) {
|
||||
right_mode = FP_SNIPING_MODE;
|
||||
}
|
||||
|
||||
|
||||
fp_set_cpi_combined_by_mode(left_mode, right_mode);
|
||||
#else
|
||||
fp_set_cpi_by_mode(FP_POINTING_MODE);
|
||||
|
|
@ -314,9 +314,36 @@ uint32_t fp_zoom_unset_hold(uint32_t triger_time, void *cb_arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
report_mouse_t fp_pre_process_scrolling_report(report_mouse_t mouse_report) {
|
||||
static int16_t scroll_buffer_x = 0;
|
||||
static int16_t scroll_buffer_y = 0;
|
||||
|
||||
#ifdef FP_POINTING_SCROLLING_X_REVERSED
|
||||
scroll_buffer_x -= mouse_report.x;
|
||||
#else
|
||||
scroll_buffer_x += mouse_report.x;
|
||||
#endif
|
||||
#ifdef FP_POINTING_SCROLLING_Y_REVERSED
|
||||
scroll_buffer_y += mouse_report.y;
|
||||
#else
|
||||
scroll_buffer_y -= mouse_report.y;
|
||||
#endif
|
||||
if (abs(scroll_buffer_x) > FP_POINTING_SCROLLING_THRESHOLD) {
|
||||
mouse_report.h = scroll_buffer_x > 0 ? 1 : -1;
|
||||
scroll_buffer_x = 0;
|
||||
}
|
||||
if (abs(scroll_buffer_y) > FP_POINTING_SCROLLING_THRESHOLD) {
|
||||
mouse_report.v = scroll_buffer_y > 0 ? 1 : -1;
|
||||
scroll_buffer_y = 0;
|
||||
}
|
||||
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
#ifdef CONSOLE_ENABLE
|
||||
if (mouse_report.x != 0) {
|
||||
xprintf("fingerpunch mouse report x: %d\n", mouse_report.x);
|
||||
|
|
@ -326,26 +353,8 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
|||
}
|
||||
#endif
|
||||
if (fp_scroll_layer_get() || fp_scroll_keycode_get()) {
|
||||
#ifdef FP_POINTING_SCROLLING_X_REVERSED
|
||||
scroll_buffer_x -= mouse_report.x;
|
||||
#else
|
||||
scroll_buffer_x += mouse_report.x;
|
||||
#endif
|
||||
#ifdef FP_POINTING_SCROLLING_Y_REVERSED
|
||||
scroll_buffer_y += mouse_report.y;
|
||||
#else
|
||||
scroll_buffer_y -= mouse_report.y;
|
||||
#endif
|
||||
if (abs(scroll_buffer_x) > FP_POINTING_SCROLLING_THRESHOLD) {
|
||||
mouse_report.h = scroll_buffer_x > 0 ? 1 : -1;
|
||||
scroll_buffer_x = 0;
|
||||
}
|
||||
if (abs(scroll_buffer_y) > FP_POINTING_SCROLLING_THRESHOLD) {
|
||||
mouse_report.v = scroll_buffer_y > 0 ? 1 : -1;
|
||||
scroll_buffer_y = 0;
|
||||
}
|
||||
mouse_report.x = 0;
|
||||
mouse_report.y = 0;
|
||||
// Important to preprocess the scrolling values to account for scrolling reverse or scrolling threshold
|
||||
mouse_report = fp_pre_process_scrolling_report(mouse_report);
|
||||
} else if (fp_zoom_layer_get() || fp_zoom_keycode_get()) {
|
||||
bool zoom_in = false;
|
||||
mouse_xy_report_t zoom_value = mouse_report.y;
|
||||
|
|
@ -409,17 +418,13 @@ report_mouse_t pointing_device_task_combined_kb(report_mouse_t left_report, repo
|
|||
right_report = pointing_device_task_kb(right_report);
|
||||
} else {
|
||||
if (FP_POINTING_COMBINED_SCROLLING_LEFT) {
|
||||
left_report.h = left_report.x;
|
||||
left_report.v = -left_report.y;
|
||||
left_report.x = 0;
|
||||
left_report.y = 0;
|
||||
// Important to preprocess the scrolling values to account for scrolling reverse or scrolling threshold
|
||||
left_report = fp_pre_process_scrolling_report(left_report);
|
||||
}
|
||||
|
||||
if (FP_POINTING_COMBINED_SCROLLING_RIGHT) {
|
||||
right_report.h = right_report.x;
|
||||
right_report.v = -right_report.y;
|
||||
right_report.x = 0;
|
||||
right_report.y = 0;
|
||||
// Important to preprocess the scrolling values to account for scrolling reverse or scrolling threshold
|
||||
right_report = fp_pre_process_scrolling_report(right_report);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ void fp_zoom_keycode_toggle(void);
|
|||
void fp_zoom_keycode_set(bool zoom_value);
|
||||
bool fp_zoom_keycode_get(void);
|
||||
uint32_t fp_zoom_unset_hold(uint32_t triger_time, void *cb_arg);
|
||||
report_mouse_t fp_pre_process_scrolling_report(report_mouse_t mouse_report);
|
||||
layer_state_t fp_layer_state_set_pointing(layer_state_t state);
|
||||
bool fp_process_record_pointing(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
|
|
@ -101,7 +102,7 @@ bool fp_process_record_pointing(uint16_t keycode, keyrecord_t *record);
|
|||
# endif
|
||||
|
||||
# ifndef FP_POINTING_SCROLLING_THRESHOLD
|
||||
# define FP_POINTING_SCROLLING_THRESHOLD 6
|
||||
# define FP_POINTING_SCROLLING_THRESHOLD 10
|
||||
# endif
|
||||
|
||||
# ifndef FP_POINTING_SCROLLING_LAYER
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#define FP_POINTING_COMBINED_SCROLLING_LEFT false
|
||||
#define FP_POINTING_COMBINED_SNIPING_LEFT true
|
||||
// #define FP_POINTING_COMBINED_SCROLLING_LEFT false
|
||||
// #define FP_POINTING_COMBINED_SNIPING_LEFT true
|
||||
|
||||
#ifdef DEBOUNCE
|
||||
#undef DEBOUNCE
|
||||
|
|
@ -11,4 +11,4 @@
|
|||
#define MASTER_RIGHT
|
||||
#define PS2_CLOCK_PIN GP6
|
||||
#define PS2_DATA_PIN GP5
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue