From: Alexandros Frantzis alexandros.frantzis@collabora.com
--- dlls/winewayland.drv/wayland_keyboard.c | 31 ++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/winewayland.drv/wayland_keyboard.c b/dlls/winewayland.drv/wayland_keyboard.c index 04a1c0a9fc3..8c6ba86d915 100644 --- a/dlls/winewayland.drv/wayland_keyboard.c +++ b/dlls/winewayland.drv/wayland_keyboard.c @@ -647,6 +647,35 @@ static void release_all_keys(HWND hwnd) } }
+static UINT scan2vkey(UINT scan) +{ + UINT vkey = NtUserMapVirtualKeyEx(scan, MAPVK_VSC_TO_VK_EX, keyboard_hkl); + BYTE state[256]; + UINT num_vkey; + + switch (scan) + { + case KEY_KP0: num_vkey = VK_NUMPAD0; break; + case KEY_KP1: num_vkey = VK_NUMPAD1; break; + case KEY_KP2: num_vkey = VK_NUMPAD2; break; + case KEY_KP3: num_vkey = VK_NUMPAD3; break; + case KEY_KP4: num_vkey = VK_NUMPAD4; break; + case KEY_KP5: num_vkey = VK_NUMPAD5; break; + case KEY_KP6: num_vkey = VK_NUMPAD6; break; + case KEY_KP7: num_vkey = VK_NUMPAD7; break; + case KEY_KP8: num_vkey = VK_NUMPAD8; break; + case KEY_KP9: num_vkey = VK_NUMPAD9; break; + case KEY_KPDOT: num_vkey = VK_DECIMAL; break; + default: num_vkey = vkey; break; + } + + if (num_vkey != vkey && get_async_key_state(state) && + (state[VK_NUMLOCK] & 1) && !(state[VK_SHIFT] & 0x80)) + return num_vkey; + + return vkey; +} + /********************************************************************** * Keyboard handling */ @@ -825,7 +854,7 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard,
input.type = INPUT_KEYBOARD; input.ki.wScan = scan & 0xff; - input.ki.wVk = NtUserMapVirtualKeyEx(scan, MAPVK_VSC_TO_VK_EX, keyboard_hkl); + input.ki.wVk = scan2vkey(scan); if (scan & ~0xff) input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
if (state == WL_KEYBOARD_KEY_STATE_RELEASED) input.ki.dwFlags |= KEYEVENTF_KEYUP;