mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Merge branch 'shell' into BetterMemory
This commit is contained in:
commit
e854a92753
@ -28,37 +28,44 @@
|
||||
|
||||
#include "scan.c"
|
||||
|
||||
static bool capsLockActive = 0;
|
||||
static bool leftAltPressed = 0;
|
||||
static bool leftShiftPressed = 0;
|
||||
static bool leftControlPressed = 0;
|
||||
#define KEY(code) (table[2*(code)])
|
||||
#define FLAGS(code) (table[2*(code)+1])
|
||||
|
||||
void KeybPrint(uchar _code)
|
||||
static bool capsLockActive = 0;
|
||||
static bool altPressed = 0;
|
||||
static bool shiftPressed = 0;
|
||||
static bool controlPressed = 0;
|
||||
|
||||
static void KeybPrint(uchar _code)
|
||||
{
|
||||
uint code = (uint)_code;
|
||||
|
||||
const uint *table =
|
||||
(leftAltPressed ? LeftAltScanCodes
|
||||
: (leftShiftPressed ? LeftShiftScanCodes
|
||||
: (leftControlPressed ? LeftControlScanCodes
|
||||
(altPressed ? LeftAltScanCodes
|
||||
: (controlPressed ? LeftControlScanCodes
|
||||
: (shiftPressed ? LeftShiftScanCodes
|
||||
: RegularScanCodes)));
|
||||
|
||||
if (capsLockActive && !leftShiftPressed &&
|
||||
!!(table[2 * code + 1] & CAPSLOCK) && !leftAltPressed)
|
||||
table = LeftShiftScanCodes;
|
||||
if ((capsLockActive && (FLAGS(code) & CAPSLOCK))
|
||||
&& !(altPressed || controlPressed)) {
|
||||
if (shiftPressed)
|
||||
table = RegularScanCodes;
|
||||
else
|
||||
table = LeftShiftScanCodes;
|
||||
}
|
||||
|
||||
uchar ch = table[2 * code];
|
||||
uchar ch = KEY(code);
|
||||
|
||||
if (!ch) {
|
||||
switch (code) {
|
||||
case 0x38: leftAltPressed = 1; break;
|
||||
case 0xB8: leftAltPressed = 0; break;
|
||||
case 0x38: altPressed = 1; break;
|
||||
case 0xB8: altPressed = 0; break;
|
||||
|
||||
case 0x36: case 0x2A: leftShiftPressed = 1; break;
|
||||
case 0xB6: case 0xAA: leftShiftPressed = 0; break;
|
||||
case 0x36: case 0x2A: shiftPressed = 1; break;
|
||||
case 0xB6: case 0xAA: shiftPressed = 0; break;
|
||||
|
||||
case 0x1D: leftControlPressed = 1; break;
|
||||
case 0x9D: leftControlPressed = 0; break;
|
||||
case 0x1D: controlPressed = 1; break;
|
||||
case 0x9D: controlPressed = 0; break;
|
||||
|
||||
case 0x3A: capsLockActive = !capsLockActive; break;
|
||||
}
|
||||
@ -66,7 +73,7 @@ void KeybPrint(uchar _code)
|
||||
}
|
||||
|
||||
bputc(BStdIn, ch);
|
||||
if (code && (table[2 * code + 1] & INVISIBLE) == 0) {
|
||||
if (code && (FLAGS(code) & INVISIBLE) == 0) {
|
||||
bputc(BStdOut, table[2 * code]);
|
||||
BStdOut->flusher(BStdOut);
|
||||
}
|
||||
|
@ -94,7 +94,10 @@ const uint RegularScanCodes[2 * 256] =
|
||||
ENTRY (0x33, ';', CAPSLOCK),
|
||||
ENTRY (0x34, ':', CAPSLOCK),
|
||||
ENTRY (0x35, '!', CAPSLOCK),
|
||||
|
||||
ENTRY (0x39, ' ', NONE),
|
||||
};
|
||||
|
||||
const uint LeftShiftScanCodes[2 * 256] =
|
||||
{
|
||||
ENTRY (0x00, 0, INVISIBLE|INVALID),
|
||||
@ -157,15 +160,10 @@ const uint LeftShiftScanCodes[2 * 256] =
|
||||
ENTRY (0x33, '.', NONE),
|
||||
ENTRY (0x34, '/', NONE),
|
||||
ENTRY (0x35, '!', NONE),
|
||||
|
||||
ENTRY (0x39, ' ', NONE),
|
||||
};
|
||||
|
||||
const uint LeftAltScanCodes[2 * 256];
|
||||
const uint LeftControlScanCodes[2 * 256];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user