@ -419,12 +419,14 @@ void ImGui_ImplWin32_NewFrame()
ImGui_ImplWin32_UpdateGamepads ( ) ;
}
// There is no distinct VK_xxx for keypad enter, instead it is VK_RETURN + KF_EXTENDED, we assign it an arbitrary value to make code more readable (VK_ codes go up to 255)
# define IM_VK_KEYPAD_ENTER (VK_RETURN + 256)
// Map VK_xxx to ImGuiKey_xxx.
static ImGuiKey ImGui_ImplWin32_VirtualKeyToImGuiKey ( WPARAM wParam )
// Not static to allow third-party code to use that if they want to (but undocumented)
ImGuiKey ImGui_ImplWin32_KeyEventToImGuiKey ( WPARAM wParam , LPARAM lParam )
{
// There is no distinct VK_xxx for keypad enter, instead it is VK_RETURN + KF_EXTENDED.
if ( ( wParam = = VK_RETURN ) & & ( HIWORD ( lParam ) & KF_EXTENDED ) )
return ImGuiKey_KeypadEnter ;
switch ( wParam )
{
case VK_TAB : return ImGuiKey_Tab ;
@ -473,7 +475,6 @@ static ImGuiKey ImGui_ImplWin32_VirtualKeyToImGuiKey(WPARAM wParam)
case VK_MULTIPLY : return ImGuiKey_KeypadMultiply ;
case VK_SUBTRACT : return ImGuiKey_KeypadSubtract ;
case VK_ADD : return ImGuiKey_KeypadAdd ;
case IM_VK_KEYPAD_ENTER : return ImGuiKey_KeypadEnter ;
case VK_LSHIFT : return ImGuiKey_LeftShift ;
case VK_LCONTROL : return ImGuiKey_LeftCtrl ;
case VK_LMENU : return ImGuiKey_LeftAlt ;
@ -692,12 +693,9 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
// Submit modifiers
ImGui_ImplWin32_UpdateKeyModifiers ( ) ;
// Obtain virtual key code
// (keypad enter doesn't have its own... VK_RETURN with KF_EXTENDED flag means keypad enter, see IM_VK_KEYPAD_ENTER definition for details, it is mapped to ImGuiKey_KeyPadEnter.)
int vk = ( int ) wParam ;
if ( ( wParam = = VK_RETURN ) & & ( HIWORD ( lParam ) & KF_EXTENDED ) )
vk = IM_VK_KEYPAD_ENTER ;
const ImGuiKey key = ImGui_ImplWin32_VirtualKeyToImGuiKey ( vk ) ;
// Obtain virtual key code and convert to ImGuiKey
const ImGuiKey key = ImGui_ImplWin32_KeyEventToImGuiKey ( wParam , lParam ) ;
const int vk = ( int ) wParam ;
const int scancode = ( int ) LOBYTE ( HIWORD ( lParam ) ) ;
// Special behavior for VK_SNAPSHOT / ImGuiKey_PrintScreen as Windows doesn't emit the key down event.