blob: 212f45ffdb4aaea1d6ce4ed1185765b980b6280f (
plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/* Copyright 2020 farfalleflickan <farfalleflickan@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
void add_to_prev(uint16_t kc);
void unreg_prev(void);
void timer_timeout_keymap(void);
bool process_record_user(uint16_t keycode, keyrecord_t *record);
// Normal shift status
#define SHIFT_NORM(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
if (lshift) { \
register_code(KC_LSFT); \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(KC_LSFT); \
unregister_code(kc1); \
register_code(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
} \
return false;
// Always shifted
#define SHIFT_ALL(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
register_code(KC_LSFT); \
if (lshift) { \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(kc1); \
register_code(kc1); \
add_to_prev(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
unreg_prev(); \
if (lshift) \
register_code(KC_LSFT); \
else \
unregister_code(KC_LSFT); \
} \
return false;
// Never shifted
#define SHIFT_NO(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
unregister_code(KC_LSFT); \
if (lshift) { \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(kc1); \
register_code(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
unreg_prev(); \
if (lshift) \
register_code(KC_LSFT); \
else \
unregister_code(KC_LSFT); \
} \
return false;
//Never RALT
#define RALT_NO(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
unregister_code(KC_RALT); \
if (ralt) { \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(kc1); \
register_code(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
unreg_prev(); \
if (ralt) \
register_code(KC_RALT); \
else \
unregister_code(KC_RALT); \
} \
return false;
|