diff --git a/include/uiohook.h b/include/uiohook.h index 49856805..669e5f6e 100644 --- a/include/uiohook.h +++ b/include/uiohook.h @@ -298,17 +298,17 @@ typedef void (*dispatcher_t)(uiohook_event * const, void *); #define VC_KP_8 0x0068 #define VC_KP_9 0x0069 -#define VC_KP_END 0xEE00 | VC_KP_1 -#define VC_KP_DOWN 0xEE00 | VC_KP_2 -#define VC_KP_PAGE_DOWN 0xEE00 | VC_KP_3 -#define VC_KP_LEFT 0xEE00 | VC_KP_4 -#define VC_KP_BEGIN 0xEE00 | VC_KP_5 -#define VC_KP_RIGHT 0xEE00 | VC_KP_6 -#define VC_KP_HOME 0xEE00 | VC_KP_7 -#define VC_KP_UP 0xEE00 | VC_KP_8 -#define VC_KP_PAGE_UP 0xEE00 | VC_KP_9 -#define VC_KP_INSERT 0xEE00 | VC_KP_0 -#define VC_KP_DELETE 0xEE00 | VC_KP_SEPARATOR +#define VC_KP_END 0xEE00 | VC_END +#define VC_KP_DOWN 0xEE00 | VC_DOWN +#define VC_KP_PAGE_DOWN 0xEE00 | VC_PAGE_DOWN +#define VC_KP_LEFT 0xEE00 | VC_LEFT +#define VC_KP_BEGIN 0xEE00 | VC_BEGIN +#define VC_KP_RIGHT 0xEE00 | VC_RIGHT +#define VC_KP_HOME 0xEE00 | VC_HOME +#define VC_KP_UP 0xEE00 | VC_UP +#define VC_KP_PAGE_UP 0xEE00 | VC_PAGE_UP +#define VC_KP_INSERT 0xEE00 | VC_INSERT +#define VC_KP_DELETE 0xEE00 | VC_DELETE // End Numeric Zone diff --git a/src/windows/input_helper.c b/src/windows/input_helper.c index 1071ba9c..439aaded 100644 --- a/src/windows/input_helper.c +++ b/src/windows/input_helper.c @@ -301,10 +301,21 @@ uint16_t vkcode_to_uiocode(DWORD vk_code, DWORD flags) { if (vk_code < sizeof(uiocode_vkcode_table) / sizeof(uiocode_vkcode_table[0])) { uiocode = uiocode_vkcode_table[vk_code][0]; + // Check the extended key flag as defined at: + // https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag if (flags & LLKHF_EXTENDED) { logger(LOG_LEVEL_DEBUG, "%s [%u]: Using extended lookup for vk_code: %li\n", __FUNCTION__, __LINE__, vk_code); + switch (vk_code) { + case VK_RETURN: + uiocode = VC_KP_ENTER; + break; + } + } else { + logger(LOG_LEVEL_DEBUG, "%s [%u]: Using normal lookup for vk_code: %li\n", + __FUNCTION__, __LINE__, vk_code); + switch (vk_code) { case VK_PRIOR: case VK_NEXT: @@ -319,14 +330,7 @@ uint16_t vkcode_to_uiocode(DWORD vk_code, DWORD flags) { case VK_DELETE: uiocode |= 0xEE00; break; - - case VK_RETURN: - uiocode |= 0x0E00; - break; } - } else { - logger(LOG_LEVEL_DEBUG, "%s [%u]: Using normal lookup for vk_code: %li\n", - __FUNCTION__, __LINE__, vk_code); } }