diff options
Diffstat (limited to 'keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c')
-rw-r--r-- | keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c b/keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c index 7784bc855..fbf07935c 100644 --- a/keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c +++ b/keyboards/ploopyco/trackball/keymaps/drag_scroll/keymap.c | |||
@@ -17,42 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | #include QMK_KEYBOARD_H | 18 | #include QMK_KEYBOARD_H |
19 | 19 | ||
20 | // used for tracking the state | ||
21 | bool is_drag_scroll = false; | ||
22 | |||
23 | enum custom_keycodes { | ||
24 | DRAG_SCROLL = PLOOPY_SAFE_RANGE, | ||
25 | }; | ||
26 | |||
27 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
28 | switch (keycode) { | ||
29 | case DRAG_SCROLL: | ||
30 | if (record->event.pressed) { | ||
31 | // this toggles the state each time you tap it | ||
32 | is_drag_scroll ^= 1; | ||
33 | } | ||
34 | break; | ||
35 | } | ||
36 | return true; | ||
37 | } | ||
38 | |||
39 | // The real magic is here. | ||
40 | // This function is called to translate the processed sensor movement | ||
41 | // from the mouse sensor and translates it into x and y movement for | ||
42 | // the mouse report. Normally. So if "drag scroll" is toggled on, | ||
43 | // moving the ball scrolls instead. You could remove the x or y here | ||
44 | // to only scroll in one direction, if you wanted, as well. In fact, | ||
45 | // there is no reason that you need to send this to the mouse report. | ||
46 | // You could have it register a key, instead. | ||
47 | void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { | ||
48 | if (is_drag_scroll) { | ||
49 | mouse_report->h = x; | ||
50 | mouse_report->v = y; | ||
51 | } else { | ||
52 | mouse_report->x = x; | ||
53 | mouse_report->y = y; | ||
54 | } | ||
55 | } | ||
56 | 20 | ||
57 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
58 | [0] = LAYOUT( /* Base */ | 22 | [0] = LAYOUT( /* Base */ |