Skip to content

Commit 26ebf41

Browse files
committed
Implemented Layer 1 ` and ´
1 parent 9092c96 commit 26ebf41

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/main.c

+22-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ TCHAR mapScanCodeToChar(unsigned level, char in)
3030

3131
switch (level) {
3232
case 1:
33-
wcscpy(mappingTable + 16, L"xvlcwkhgfqß");
33+
wcscpy(mappingTable + 2, L"1234567890-`");
34+
wcscpy(mappingTable + 16, L"xvlcwkhgfqß´");
3435
wcscpy(mappingTable + 30, L"uiaeosnrtdy");
3536
wcscpy(mappingTable + 44, L"üöäpzbm,.j");
3637
break;
@@ -96,6 +97,24 @@ void sendChar(TCHAR key, KBDLLHOOKSTRUCT keyInfo)
9697
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
9798
}
9899

100+
bool handleLayer1SpecialCases(KBDLLHOOKSTRUCT keyInfo)
101+
{
102+
switch(keyInfo.scanCode) {
103+
case 13:
104+
sendChar(L'`', keyInfo);
105+
keybd_event(VK_SPACE, 0, 0, 0);
106+
return true;
107+
case 27:
108+
sendChar(L'´', keyInfo);
109+
keybd_event(VK_SPACE, 0, 0, 0);
110+
return true;
111+
default:
112+
return false;
113+
}
114+
115+
}
116+
117+
99118
bool handleLayer4SpecialCases(KBDLLHOOKSTRUCT keyInfo)
100119
{
101120
unsigned len = 103;
@@ -209,6 +228,8 @@ LRESULT CALLBACK keyevent(int code, WPARAM wparam, LPARAM lparam)
209228
keybd_event(VK_RMENU, 0, KEYEVENTF_KEYUP, 0);
210229
mod4Pressed = true;
211230
return -1;
231+
} else if (level == 1 && handleLayer1SpecialCases(keyInfo)) {
232+
return -1;
212233
} else if (level == 4 && handleLayer4SpecialCases(keyInfo)) {
213234
return -1;
214235
} else {

0 commit comments

Comments
 (0)