mirror of
https://github.com/glfw/glfw.git
synced 2026-11-17 20:28:55 +00:00
Win32: Fix scancode for media keys
Media key events were incorrectly reported with a scancode of 0x100. This is based on a snippet by dougbinks in #2625. Fixes #1768 Closes #2417 Fixes #2625
This commit is contained in:
+5
-4
@@ -711,11 +711,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
|
||||
const int mods = getKeyMods();
|
||||
|
||||
scancode = (HIWORD(lParam) & (KF_EXTENDED | 0xff));
|
||||
if (!scancode)
|
||||
if (!(scancode & 0xff))
|
||||
{
|
||||
// NOTE: Some synthetic key messages have a scancode of zero
|
||||
// HACK: Map the virtual key back to a usable scancode
|
||||
scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
|
||||
// NOTE: Both media keys and the synthetic key messages from Windows
|
||||
// Clipboard History are reported with a scancode of zero
|
||||
// HACK: Map the virtual key to a scancode but preserve extended bit
|
||||
scancode |= MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
|
||||
}
|
||||
|
||||
// HACK: Alt+PrtSc has a different scancode than just PrtSc
|
||||
|
||||
Reference in New Issue
Block a user