Expand description
§Fullscreen toggle requests — app → platform shell
Apps can’t touch the winit window or the browser document, so a
fullscreen toggle is a request: the app calls request_toggle
(from a click or keydown handler — browsers demand a user gesture),
and the platform shell polls take_request once per frame and
performs the switch (winit set_fullscreen natively,
requestFullscreen/exitFullscreen on the canvas in a browser).
Shells report the resulting state through set_active so apps
can render the right icon via is_active.
Functions§
- is_
active - The last state a shell reported — drives expand/compress icons.
- request_
toggle - Ask the platform shell to toggle fullscreen (e.g. from an Alt+Enter handler or a UI button). Coalesces: several requests in one frame still toggle once.
- set_
active - Shell side: record the actual state after switching (or after the user left fullscreen through the OS/browser, e.g. Esc).
- take_
request - Shell side: consume a pending toggle request, if any.