Skip to content

Windows (vendored winit): make a window with the boxes it asks for - #760

Merged
Hona merged 1 commit into
devfrom
ib-3-buttons
Nov 12, 2026
Merged

Hona merged 1 commit into
devfrom
ib-3-buttons

Conversation

@Hona

@Hona Hona commented Nov 12, 2026

Copy link
Copy Markdown
Member

winit's Windows init starts the window's flags with CLOSABLE only. on_create then calls set_enabled_buttons(attributes.enabled_buttons), which for the default buttons adds MINIMIZABLE and MAXIMIZABLE. That diff rewrites GWL_STYLE/GWL_EXSTYLE and sends a second SWP_FRAMECHANGED, still inside CreateWindowExW: 1,049 µs p50 on the first window's path (w.visible → w.buttons, tabs10, release, visible desktop, n=8, temporary marks on ib-3-createmarks).

The vendored winit now starts MINIMIZABLE/MAXIMIZABLE from attributes.enabled_buttons, so CreateWindowExW gets the final styles and that call changes nothing. CLOSABLE keeps its default (on), so a window without Close still disables it through that call, as before.

  • vendor/winit.patch re-made against winit 0.30.13 from crates.io; it applies and reproduces vendor/winit exactly.
  • scripts/vendor-winit.sh's description updated.
  • cargo check -p rune --all-targets: no new warnings. No tests touched.

winit made every window without WS_MINIMIZEBOX and WS_MAXIMIZEBOX, then added them in
on_create's set_enabled_buttons: SetWindowLongW twice and a second SWP_FRAMECHANGED before the
first frame, 1,049 us p50 (tabs10, release, n=8). The flags now start as the attributes ask,
so that call changes nothing. Close keeps its default (on), so a window without Close still
disables it through that call.
Copilot AI balanced review requested due to automatic review settings November 12, 2026 08:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Hona
Hona merged commit bbe7324 into dev Nov 12, 2026
1 check passed
Hona added a commit that referenced this pull request Nov 12, 2026
…774)

Started before EventLoop::new (#757), EnumDisplayDevicesW on its thread contended with winit's
first CreateWindowExW and made windows.launch -> loop.built 1,134 us slower (5,428 against 4,294,
p50, n=10). Started just after loop.built, it runs while the app sets up: +131 us there, and the
first window's path (loop + creation) is 10,949 us against 13,247 before #757-#760.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants