From 7cf6d726332de6558e648883892b1c98f8c1c301 Mon Sep 17 00:00:00 2001 From: kimci86 Date: Sun, 17 Apr 2022 18:24:17 +0200 Subject: [PATCH] Avoid overwriting key to scancode mapping --- src/SFML/Window/Win32/InputImpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SFML/Window/Win32/InputImpl.cpp b/src/SFML/Window/Win32/InputImpl.cpp index fd02e10d6..122aef227 100644 --- a/src/SFML/Window/Win32/InputImpl.cpp +++ b/src/SFML/Window/Win32/InputImpl.cpp @@ -565,7 +565,8 @@ void InputImpl::ensureMappings() Keyboard::Scancode scan = static_cast(i); UINT virtualKey = sfScanToVirtualKey(scan); Keyboard::Key key = virtualKeyToSfKey(virtualKey); - m_keyToScancodeMapping[key] = scan; + if (key != Keyboard::Unknown && m_keyToScancodeMapping[key] == Keyboard::Scan::Unknown) + m_keyToScancodeMapping[key] = scan; m_scancodeToKeyMapping[scan] = key; }