Win32: a titled window is on screen untitled until its constructor finishes #183
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#183
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
Window(width, height, title)sets the title only after the delegatedWindow(width, height)has created the HWND with an empty name, shown and activated it, and built the surface, swapchain and sync objects (implementations/Crafter.Graphics-Window.cpp:347-349,:417-435at852ae8a). Until then the window has an empty caption, and the taskbar and Alt+Tab show it without a name. A shell or accessibility hook that reads the name when the window appears (EVENT_OBJECT_SHOW,HSHELL_WINDOWCREATED) gets "". Cosmetic, and over before the constructor returns.On
master,SetTitledoes nothing on Win32 at all;claude/win32-titlemakes it work, and this is what is left after that.The title can't simply go to
CreateWindowExinstead:WM_NCCREATEreturnsTRUEwithout callingDefWindowProc(:140-148), and it isDefWindowProc'sWM_NCCREATEthat stores the create name. Under Wine, a name given toCreateWindowExWcame back empty fromGetWindowTextW, and came through onceWM_NCCREATEwent on toDefWindowProcW.Suggested fix
Have
WM_NCCREATEreturnDefWindowProcW(hwnd, msg, wParam, lParam)after storing the pointer, and give the title toCreateWindowExW. That means the three-argument constructor holds the body and the two-argument one delegates with an empty title. On Wayland the title can then be set before the first commit, and left unset when it is empty, as the two-argument constructor leaves it today.TextWin32's first check covers the result.