diff options
| author | brian cully <bjc@spork.org> | 2026-01-16 10:00:34 -0500 |
|---|---|---|
| committer | brian cully <bjc@spork.org> | 2026-01-16 10:00:34 -0500 |
| commit | 2deb9d0b742ef07136c598f255e967ea9905a815 (patch) | |
| tree | 80a0d49bf97fa84f1d3af38eaf1a7a1e46dc6437 /keyboards/ploopyco/madromys/keymaps | |
| parent | 4a4ec3dddb47c53545c7621e45240ee2c5c523d1 (diff) | |
| download | qmk-userspace-2deb9d0b742ef07136c598f255e967ea9905a815.tar.gz qmk-userspace-2deb9d0b742ef07136c598f255e967ea9905a815.zip | |
stop using ploopy's drag scroll which accumulated large errors
Diffstat (limited to 'keyboards/ploopyco/madromys/keymaps')
| -rw-r--r-- | keyboards/ploopyco/madromys/keymaps/bjc/keymap.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/keyboards/ploopyco/madromys/keymaps/bjc/keymap.c b/keyboards/ploopyco/madromys/keymaps/bjc/keymap.c index db9cd23..3b76c0a 100644 --- a/keyboards/ploopyco/madromys/keymaps/bjc/keymap.c +++ b/keyboards/ploopyco/madromys/keymaps/bjc/keymap.c @@ -40,29 +40,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // probably shouldn't be doing this, but beats trying to keep track of // it myself and getting out of sync. -extern bool is_drag_scroll; +//extern bool is_drag_scroll; + +bool drag_scroll = false; layer_state_t layer_state_set_user(layer_state_t state) { if (IS_LAYER_ON_STATE(state, FN1) || IS_LAYER_ON_STATE(state, FN2)) { - is_drag_scroll = true; + drag_scroll = true; } else { - is_drag_scroll = false; + drag_scroll = false; } return state; } +/* report_mouse_t pointing_device_task_user(report_mouse_t report) { */ +/* return report; */ +/* } */ + /* * use deferred execution to turn on a layer aften n ms of the key * being held down. */ /* -uinst32_t callback(uint32_t trigger_time, void *cb_arg) { + uinst32_t callback(uint32_t trigger_time, void *cb_arg) { return 0; -} -token = defer_exec(layer_hold_timeout, callback, NULL); -cancel_deferred_exec(token); -*/ + } + token = defer_exec(layer_hold_timeout, callback, NULL); + cancel_deferred_exec(token); + */ static bool fn1_up = false; static uint16_t fn1_release_timer = 0; @@ -90,3 +96,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } + +#define DRAGSCROLL_SHIFT_H 0 +#define DRAGSCROLL_SHIFT_V 0 + +// rejiggering ploopyco's version to not use floats +report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { + if (drag_scroll) { + mouse_report.h = mouse_report.x >> DRAGSCROLL_SHIFT_H; +#ifdef PLOOPY_DRAGSCROLL_INVERT + mouse_report.v = -(mouse_report.y >> DRAGSCROLL_SHIFT_V); +#else + mouse_report.v = mouse_report.y >> DRAGSCROLL_SHIFT_V; +#endif + + // Clear the X and Y values of the mouse report + mouse_report.x = 0; + mouse_report.y = 0; + } + + return mouse_report; +} |
