Fix get_keyboard_map on Czech (and other) layouts

Now reports proper Unicode name, and doesn't omit keys that don't have a recognised mapping by Panda
https://bugs.launchpad.net/panda3d/+bug/1652145
This commit is contained in:
rdb 2016-12-25 16:12:54 +01:00
parent 59c3aa3ef6
commit 4393455eba
2 changed files with 9 additions and 7 deletions

View File

@ -52,6 +52,7 @@ This issue fixes several bugs that were still found in 1.9.2.
* Now tries to preserve refresh rate when switching fullscreen on Windows
* Fix back-to-front sorting when gl-coordinate-system is changed
* Now also compiles on older Linux distros (eg. CentOS 5 / manylinux1)
* get_keyboard_map now includes keys on layouts with special characters
------------------------ RELEASE 1.9.2 ------------------------

View File

@ -2721,7 +2721,7 @@ ButtonMap *WinGraphicsWindow::
get_keyboard_map() const {
ButtonMap *map = new ButtonMap;
char text[256];
wchar_t text[256];
UINT vsc = 0;
unsigned short ex_vsc[] = {0x57, 0x58,
0x011c, 0x011d, 0x0135, 0x0137, 0x0138, 0x0145, 0x0147, 0x0148, 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x015b, 0x015c, 0x015d};
@ -2759,14 +2759,15 @@ get_keyboard_map() const {
UINT vk = MapVirtualKeyA(vsc, MAPVK_VSC_TO_VK_EX);
button = lookup_key(vk);
if (button == ButtonHandle::none()) {
continue;
}
//if (button == ButtonHandle::none()) {
// continue;
//}
}
int len = GetKeyNameTextA(lparam, text, 256);
string label (text, len);
map->map_button(raw_button, button, label);
int len = GetKeyNameTextW(lparam, text, 256);
TextEncoder enc;
enc.set_wtext(wstring(text, len));
map->map_button(raw_button, button, enc.get_text());
}
return map;