Rework WindowMode::Fullscreen API #17525
Open
+105
−96
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Solution
This PR changes the exclusive fullscreen window mode to require the type
WindowMode::Fullscreen(MonitorSelection, VideoModeSelection)
and removesWindowMode::SizedFullscreen
. This API somewhat intentionally more closely resembles Winit 0.31's upcoming fullscreen and video mode API.The new VideoModeSelection enum is specified as follows:
Changing default behaviour
This might be contentious because it removes the previous behaviour of
WindowMode::Fullscreen
which selected the highest resolution possible. While the previous behaviour would be quite easy to re-implement as additional options, or as an impl method on Monitor, I would argue that this isn't an implementation that should be encouraged.From the perspective of a Windows user, I prefer what the majority of modern games do when entering fullscreen which is to preserve the OS's current resolution settings, which allows exclusive fullscreen to be entered faster, and to only have it change if I manually select it in either the options of the game or the OS. The highest resolution available is not necessarily what the user prefers.
I am open to changing this if I have just missed a good use case for it.
Likewise, the only functionality that
WindowMode::SizedFullscreen
provided was that it selected the resolution closest to the current size of the window so it was removed since this behaviour can be replicated via the newVideoModeSelection::Specific
if necessary.Testing
Migration Guide
WindowMode::SizedFullscreen(MonitorSelection)
andWindowMode::Fullscreen(MonitorSelection)
has becomeWindowMode::Fullscreen(MonitorSelection, VideoModeSelection)
. Previously, the VideoMode was selected based on the closest resolution to the current window size for SizedFullscreen and the largest resolution for Fullscreen. It is possible to replicate that behaviour by searchingMonitor::video_modes
and selecting it withVideoModeSelection::Specific(VideoMode)
but it is recommended to useVideoModeSelection::Current
as the default video mode when entering fullscreen.