Win32: Alt+F4 does not close the window, as WM_SYSKEYDOWN never reaches DefWindowProc #179
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#179
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On Win32, Alt+F4 does not close a Crafter window:
onClosenever fires andopenstays true. Line numbers refer toimplementations/Crafter.Graphics-Window.cppat852ae8a.WndProchandlesWM_SYSKEYDOWNtogether withWM_KEYDOWN(:181-193), and the case ends inbreak, so the message returns 0 (:341) without reachingDefWindowProc. Alt+F4 isDefWindowProc's doing: for aWM_SYSKEYDOWNofVK_F4with Alt held it sendsWM_SYSCOMMANDSC_CLOSE, which would become theWM_CLOSEthat:158turns intoonClose.Only the title bar's close button, or the system menu opened from the title bar, closes the window. Under Wine, a window manager that takes Alt+F4 itself hides the bug.
Found while reviewing
claude/win32-title.Suggested fix
Report the key as now, then return
DefWindowProc(hwnd, msg, wParam, lParam)forWM_SYSKEYDOWN(DefWindowProcWonceclaude/win32-titlelands).WM_SYSKEYUPcan stay swallowed, which keeps a lone Alt or F10 from putting the window into menu mode.PointerWin32can check it: postWM_SYSKEYDOWNwithVK_F4and the Alt bit (29) set inlParam, and expectonClose.