Skip to content
Snippets Groups Projects
Commit b598e9b2 authored by deuce's avatar deuce
Browse files

Fix up CTRL key handling.

parent 81f08f66
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ void input_thread(void *args) ...@@ -15,6 +15,7 @@ void input_thread(void *args)
int key; int key;
INPUT_RECORD ckey; INPUT_RECORD ckey;
int alt=0; int alt=0;
int ctrl=0;
DWORD d; DWORD d;
SHORT s; SHORT s;
...@@ -46,6 +47,30 @@ void input_thread(void *args) ...@@ -46,6 +47,30 @@ void input_thread(void *args)
if(alt) if(alt)
continue; continue;
} }
if(key < ' ') {
/* If this is NOT a "normal" key, fiddle with CTRL */
switch(key) {
case 8:
case 9:
case 10:
case 13:
case 27:
break;
default:
ctrl=1;
ckey.Event.KeyEvent.bKeyDown=TRUE;
ckey.Event.KeyEvent.dwControlKeyState = LEFT_CTRL_PRESSED;
ckey.Event.KeyEvent.wRepeatCount=1;
ckey.Event.KeyEvent.wVirtualKeyCode=VK_CONTROL;
ckey.Event.KeyEvent.wVirtualScanCode=MapVirtualKey(ckey.Event.KeyEvent.wVirtualKeyCode, 0);
ckey.Event.KeyEvent.uChar.AsciiChar=0;
d=0;
while(!d) {
if(!WriteConsoleInput(console_input, &ckey, 1, &d))
d=0;
}
}
}
ckey.Event.KeyEvent.bKeyDown=TRUE; ckey.Event.KeyEvent.bKeyDown=TRUE;
ckey.Event.KeyEvent.wRepeatCount=1; ckey.Event.KeyEvent.wRepeatCount=1;
...@@ -175,6 +200,20 @@ void input_thread(void *args) ...@@ -175,6 +200,20 @@ void input_thread(void *args)
} }
alt=0; alt=0;
} }
if(ctrl) {
ckey.Event.KeyEvent.bKeyDown=FALSE;
ckey.Event.KeyEvent.wRepeatCount=1;
ckey.Event.KeyEvent.wVirtualKeyCode=VK_CONTROL;
ckey.Event.KeyEvent.wVirtualScanCode=MapVirtualKey(ckey.Event.KeyEvent.wVirtualKeyCode, 0);
ckey.Event.KeyEvent.uChar.AsciiChar=0;
ckey.Event.KeyEvent.dwControlKeyState = LEFT_CTRL_PRESSED;
d=0;
while(!d) {
if(!WriteConsoleInput(console_input, &ckey, 1, &d))
d=0;
}
alt=0;
}
} }
input_thread_running=0; input_thread_running=0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment