feat: switch text to UTF-8; add Unicode key events, dead keys & Czech layout; fix numpad navigation; add NumLock support
This commit is contained in:
1 parent
32660ddd1a
commit
2aa6360b3d
101 files changed
+3733
-1639
No files matched your search
@@ -139,6 +139,7 @@ namespace Drivers::PS2::Keyboard {
|
||||
ack = Drivers::PS2::ReadData();
|
||||
|
||||
g_Modifiers = {};
|
||||
g_Modifiers.NumLock = true; // keypad types digits, as on most PCs
|
||||
g_BufferHead = 0;
|
||||
g_BufferTail = 0;
|
||||
g_ExtendedScancode = false;
|
||||
@@ -257,6 +258,9 @@ namespace Drivers::PS2::Keyboard {
|
||||
ascii = g_ScancodeToAscii[keycode];
|
||||
}
|
||||
}
|
||||
// Num Lock off: the keypad is navigation keys, which type nothing.
|
||||
if (!g_Modifiers.NumLock && IsKeypadNavScancode(keycode))
|
||||
ascii = 0;
|
||||
|
||||
KeyEvent event = {
|
||||
.Scancode = scancode,
|
||||
@@ -310,6 +314,12 @@ namespace Drivers::PS2::Keyboard {
|
||||
KeyEvent stamped = event;
|
||||
if (stamped.Scancode == ScCapsLock && stamped.Pressed)
|
||||
g_Modifiers.CapsLock = !g_Modifiers.CapsLock;
|
||||
// Num Lock likewise. Like the PS/2 path, the lock key itself is not
|
||||
// delivered to apps.
|
||||
if (stamped.Scancode == ScNumLock) {
|
||||
if (stamped.Pressed) g_Modifiers.NumLock = !g_Modifiers.NumLock;
|
||||
return;
|
||||
}
|
||||
stamped.CapsLock = g_Modifiers.CapsLock;
|
||||
PushAndNotify(stamped);
|
||||
}
|
||||
@@ -318,4 +328,8 @@ namespace Drivers::PS2::Keyboard {
|
||||
return g_Modifiers.CapsLock;
|
||||
}
|
||||
|
||||
bool GetNumLock() {
|
||||
return g_Modifiers.NumLock;
|
||||
}
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user