fixed some bugs arising from french-belgium keyboard layout
parent
16db5057d8
commit
a61de3d671
|
@ -9,6 +9,15 @@
|
|||
|
||||
// TOP
|
||||
|
||||
internal b32
|
||||
usable_ascii(char c){
|
||||
b32 result = 1;
|
||||
if ((c < ' ' || c > '~') && c != '\n' && c != '\r' && c != '\t'){
|
||||
result = 0;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
sysshared_filter_real_files(char **files, i32 *file_count){
|
||||
i32 i, j;
|
||||
|
|
|
@ -1269,18 +1269,36 @@ Win32Callback(HWND hwnd, UINT uMsg,
|
|||
UINT vk = (UINT)wParam;
|
||||
UINT scan = (UINT)((lParam >> 16) & 0x7F);
|
||||
BYTE state[256];
|
||||
WORD x1 = 0, x2 = 0, x = 0;
|
||||
BYTE control_state = 0;
|
||||
WORD x1 = 0, x2 = 0, x = 0, junk_x;
|
||||
int result1 = 0, result2 = 0, result = 0;
|
||||
|
||||
GetKeyboardState(state);
|
||||
x1 = 0;
|
||||
result1 = ToAscii(vk, scan, state, &x1, 0);
|
||||
if (result1 < 0){
|
||||
ToAscii(vk, scan, state, &junk_x, 0);
|
||||
}
|
||||
result1 = (result1 == 1);
|
||||
if (!usable_ascii((char)x1)){
|
||||
result1 = 0;
|
||||
}
|
||||
|
||||
control_state = state[VK_CONTROL];
|
||||
state[VK_CONTROL] = 0;
|
||||
x2 = 0;
|
||||
result2 = ToAscii(vk, scan, state, &x2, 0);
|
||||
if (result2 < 0){
|
||||
ToAscii(vk, scan, state, &junk_x, 0);
|
||||
}
|
||||
result2 = (result2 == 1);
|
||||
if (!usable_ascii((char)x2)){
|
||||
result2 = 0;
|
||||
}
|
||||
|
||||
if (result1){
|
||||
x = x1;
|
||||
state[VK_CONTROL] = control_state;
|
||||
result = 1;
|
||||
}
|
||||
else if (result2){
|
||||
|
@ -1296,7 +1314,15 @@ Win32Callback(HWND hwnd, UINT uMsg,
|
|||
state[VK_CAPITAL] = 0;
|
||||
x = 0;
|
||||
result = ToAscii(vk, scan, state, &x, 0);
|
||||
if (result == 1 && x < 128){
|
||||
if (result < 0){
|
||||
ToAscii(vk, scan, state, &junk_x, 0);
|
||||
}
|
||||
result = (result == 1);
|
||||
if (!usable_ascii((char)x)){
|
||||
result = 0;
|
||||
}
|
||||
|
||||
if (result){
|
||||
key = (u8)x;
|
||||
if (key == '\r') key = '\n';
|
||||
data[*count].character_no_caps_lock = key;
|
||||
|
|
Loading…
Reference in New Issue