-
Notifications
You must be signed in to change notification settings - Fork 19
/
mouse_pixel_move.h
48 lines (39 loc) · 1.18 KB
/
mouse_pixel_move.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
#pragma once
#ifndef CUSTOM_SAFE_RANGE
#error "You must specify variable CUSTOM_SAFE_RANGE for mouse pixel move keycodes."
#endif
enum mouse_pixel_move_keycodes {
MOUSE_PIXEL_MOVE_START = CUSTOM_SAFE_RANGE,
MS_DN_1,
MS_UP_1,
MS_LF_1,
MS_RG_1,
MS_DN10,
MS_UP10,
MS_LF10,
MS_RG10,
MOUSE_PIXEL_MOVE_NEW_SAFE_RANGE,
#undef CUSTOM_SAFE_RANGE
#define CUSTOM_SAFE_RANGE MOUSE_PIXEL_MOVE_NEW_SAFE_RANGE
};
// Мои языко-символьные клавиши
bool process_mouse_pixel_move(uint16_t keycode, keyrecord_t *record) {
if (!(MOUSE_PIXEL_MOVE_START < keycode && keycode < MOUSE_PIXEL_MOVE_NEW_SAFE_RANGE)) {
return true;
}
if (!record->event.pressed)
return false;
report_mouse_t currentReport = {};
switch (keycode) {
case MS_DN_1: currentReport.y = 1; break;
case MS_UP_1: currentReport.y = -1; break;
case MS_LF_1: currentReport.x = -1; break;
case MS_RG_1: currentReport.x = 1; break;
case MS_DN10: currentReport.y = 10; break;
case MS_UP10: currentReport.y = -10; break;
case MS_LF10: currentReport.x = -10; break;
case MS_RG10: currentReport.x = 10; break;
}
host_mouse_send(¤tReport);
return false;
}