add code support to make keypad behave better with swap_yz option
This is being committed commented out in include/ntconf.h.
This commit is contained in:
@@ -212,6 +212,13 @@ DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
|
||||
#define isnumkeypad(x) \
|
||||
(KEYPADLO <= (x) && (x) <= 0x51 && (x) != 0x4A && (x) != 0x4E)
|
||||
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
/* when 'numberpad' is 0 and Cmd.swap_yz is True
|
||||
(signaled by setting 0x10 on boolean numpad argument)
|
||||
treat keypress of numpad 7 as 'z' rather than 'y' */
|
||||
static boolean qwertz = FALSE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Keypad keys are translated to the normal values below.
|
||||
* Shifted keypad keys are translated to the
|
||||
@@ -301,6 +308,14 @@ int portdebug;
|
||||
const struct pad *kpad;
|
||||
DWORD count;
|
||||
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
if (numberpad & 0x10) {
|
||||
numberpad &= ~0x10;
|
||||
qwertz = TRUE;
|
||||
} else {
|
||||
qwertz = FALSE;
|
||||
}
|
||||
#endif
|
||||
shiftstate = 0L;
|
||||
ch = pre_ch = ir->Event.KeyEvent.uChar.AsciiChar;
|
||||
scan = ir->Event.KeyEvent.wVirtualScanCode;
|
||||
@@ -347,6 +362,14 @@ int portdebug;
|
||||
} else {
|
||||
ch = kpad[scan - KEYPADLO].normal;
|
||||
}
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
/* OPTIONS=number_pad:-1 is for qwertz keyboard; for that setting,
|
||||
'numberpad' will be 0; core swaps y to zap, z to move northwest;
|
||||
we want numpad 7 to move northwest, so when qwertz is set,
|
||||
tell core that user who types numpad 7 typed z rather than y */
|
||||
if (qwertz && kpad[scan - KEYPADLO].normal == 'y')
|
||||
ch += 1; /* changes y to z, Y to Z, ^Y to ^Z */
|
||||
#endif /*QWERTZ_SUPPORT*/
|
||||
} else if (altseq > 0) { /* ALT sequence */
|
||||
ReadConsoleInput(hConIn, ir, 1, &count);
|
||||
if (vk == 0xBF)
|
||||
@@ -471,6 +494,15 @@ coord *cc;
|
||||
#endif
|
||||
int ch;
|
||||
boolean valid = 0, done = 0;
|
||||
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
if (numpad & 0x10) {
|
||||
numpad &= ~0x10;
|
||||
qwertz = TRUE;
|
||||
} else {
|
||||
qwertz = FALSE;
|
||||
}
|
||||
#endif
|
||||
while (!done) {
|
||||
*count = 0;
|
||||
dwWait = WaitForSingleObject(hConIn, INFINITE);
|
||||
@@ -490,12 +522,19 @@ coord *cc;
|
||||
if (count > 0) {
|
||||
if (ir->EventType == KEY_EVENT
|
||||
&& ir->Event.KeyEvent.bKeyDown) {
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
if (qwertz)
|
||||
numpad |= 0x10;
|
||||
#endif
|
||||
ch = ProcessKeystroke(hConIn, ir, &valid, numpad,
|
||||
#ifdef PORTDEBUG
|
||||
1);
|
||||
#else
|
||||
0);
|
||||
#endif
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
numpad &= ~0x10;
|
||||
#endif
|
||||
if (valid)
|
||||
return ch;
|
||||
} else {
|
||||
@@ -549,6 +588,7 @@ INPUT_RECORD *ir;
|
||||
unsigned char ch;
|
||||
unsigned long shiftstate;
|
||||
int altseq = 0, keycode, vk;
|
||||
|
||||
done = 0;
|
||||
retval = 0;
|
||||
while (!done) {
|
||||
|
||||
Reference in New Issue
Block a user