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:
daniel committed 2026-10-03 10:11:49 +02:00
1 parent 32660ddd1a
commit 2aa6360b3d
101 files changed
+3733 -1639

No files matched your search

+14
View File
@@ -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;
}
};
+10
View File
@@ -63,4 +63,14 @@ namespace Drivers::PS2::Keyboard {
// compute ASCII, since the lock is toggled centrally here.
bool GetCapsLock();
// Current Num Lock state, owned here like Caps Lock. On (the default), the
// keypad types digits; off, it acts as the navigation keys printed on it.
bool GetNumLock();
// Set-1 scancodes of the keypad keys that are a digit/'.' with Num Lock on
// and Home/arrows/PgUp/End/PgDn/Ins/Del with it off (not '-' and '+').
inline bool IsKeypadNavScancode(uint8_t keycode) {
return keycode >= 0x47 && keycode <= 0x53 && keycode != 0x4A && keycode != 0x4E;
}
};