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:
@@ -60,6 +60,13 @@ DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
|
||||
#define PADKEYS (KEYPADHI - KEYPADLO + 1)
|
||||
#define iskeypad(x) (KEYPADLO <= (x) && (x) <= KEYPADHI)
|
||||
|
||||
#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
|
||||
@@ -120,6 +127,14 @@ int portdebug;
|
||||
int altseq = 0;
|
||||
const struct pad *kpad;
|
||||
|
||||
#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;
|
||||
@@ -163,6 +178,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 */
|
||||
if (vk == 0xBF)
|
||||
ch = M('?');
|
||||
@@ -271,6 +294,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) {
|
||||
#if defined(SAFERHANGUP)
|
||||
dwWait = WaitForSingleObjectEx(hConIn, // event object to wait for
|
||||
@@ -289,7 +321,14 @@ 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, 0);
|
||||
#ifdef QWERTZ_SUPPORT
|
||||
numpad &= ~0x10;
|
||||
#endif
|
||||
if (valid)
|
||||
return ch;
|
||||
} else if (ir->EventType == MOUSE_EVENT) {
|
||||
|
||||
Reference in New Issue
Block a user