Win32: Fix scancode and key for Alt+PrtSc events

Alt+PrtSc emits a different scancode than just PrtSc.  Since the GLFW
API assumes each key corresponds to only one scancode, this cannot be
added to the keycodes array.

Instead we replace the scancode at the point of entry.

Fixes #1993
master
Camilla Löwy ago%!(EXTRA string=3 years)
parent add0521efb
commit 03cfe957e7
  1. 1
      CONTRIBUTORS.md
  2. 2
      README.md
  3. 4
      src/win32_window.c

@ -70,6 +70,7 @@ video tutorials.
- Ryan C. Gordon
- Stephen Gowen
- Kovid Goyal
- Kevin Grandemange
- Eloi Marín Gratacós
- Stefan Gustavson
- Andrew Gutekanst

@ -210,6 +210,8 @@ information on what to include when reporting a bug.
- [Win32] Bugfix: The default restored window position was lost when creating a maximized
window
- [Win32] Bugfix: `glfwMaximizeWindow` would make a hidden window visible
- [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different
scancode than `PrtSc` (#1993)
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)

@ -752,6 +752,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
}
// HACK: Alt+PrtSc has a different scancode than just PrtSc
if (scancode == 0x54)
scancode = 0x137;
key = _glfw.win32.keycodes[scancode];
// The Ctrl keys require special handling

Loading…
Cancel
Save