Expand description
Windows: how one is asked for, what it can be told to do, and what it currently is.
§Two display modes, and no third
DisplayMode has exactly two variants because
the windowing rules in docs/notes/backends.md lock it at two. Exclusive/true fullscreen — the
mode that changes the display’s video timing — is dropped by decision,
not deferred:
- Wayland cannot modeset from a client, by design.
- macOS fights it.
- On Windows, borderless plus the DXGI flip model gets independent-flip and MPO latency close enough to exclusive that the remaining difference does not buy back the alt-tab disasters, the mode-restore-on-crash problem, or the multi-monitor breakage.
Resolution control lives one layer up instead: in
Borderless the renderer draws to an offscreen
target at whatever internal resolution it wants and upscales to the native
surface, either with a blit or — where
ShellCaps::HW_UPSCALE is set — by handing
the compositor the smaller buffer. The shell only ever presents
native-size surfaces. A DisplayMode that carried a resolution would be a
promise this crate cannot keep.
If a “true fullscreen” request ever arrives, the answer is that it is this
enum’s absence of a variant, not a ShellError::Unsupported.
§Aspect ratio is a constraint, not a mode
The windowing rules describe windowed mode as “freeform or
aspect-locked”, which reads like two modes. It is one mode with a
constraint, and the constraint lives in SizeConstraints alongside
min/max — where the windowing plan’s trait sketch,
set_constraints(win, c) // min/max/aspect, already put it. Modelling it in both places would create a question with no
good answer: if DisplayMode::Windowed { aspect: Some(16:9) } and
SizeConstraints { aspect: Some(4:3) } disagree, which wins? Keeping one
home also means an aspect lock survives a round trip through borderless and
back, which is what a player toggling modes expects.
Structs§
- Size
Constraints - Limits the window system should enforce on an interactive resize.
- Window
Configuration - What the window system has actually told us about a window.
- Window
Desc - Everything needed to create a window.
- Window
State - A window’s current, observable state.
Enums§
- Close
Reply - What to do about a close request.
- Display
Mode - How a window is presented.
- Window
- Marker type for the
Handlethat names a window.