app: prevent default Windows event handler from running for WM_SYSKEYUP/DOWN

F10 has a special meaning on Windows, if the default handler runs the
first key press following F10 will not generate a key.Press event and
if the first key press after F10 is space the window menu will be
opened instead.

Fixes #213

Signed-off-by: aarzilli <alessandro.arzilli@gmail.com>
This commit is contained in:
aarzilli
2021-04-10 09:46:19 +02:00
committed by Elias Naur
parent abd6e8f9cd
commit 495c690187
+7
View File
@@ -249,7 +249,14 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
if msg == windows.WM_KEYUP || msg == windows.WM_SYSKEYUP {
e.State = key.Release
}
w.w.Event(e)
if (wParam == windows.VK_F10) && (msg == windows.WM_SYSKEYDOWN || msg == windows.WM_SYSKEYUP) {
// Reserve F10 for ourselves, and don't let it open the system menu. Other Windows programs
// such as cmd.exe and graphical debuggers also reserve F10.
return 0
}
}
case windows.WM_LBUTTONDOWN:
w.pointerButton(pointer.ButtonPrimary, true, lParam, getModifiers())