Open ickshonpe opened 10 months ago
Can we at least rename physical_width and physical_height to logical_width and logical_height since they're.. logical?
The current api has pub fn new(physical_width: f32, physical_height: f32) -> Self {
. It also casts to u32
immediately which means that it's impossible to make odd-sized windows on double dpi screens I think?
What problem does this solve or what need does it fill?
The
WindowResolution
struct:It has a method
new
:Which looks like nonsense as we are writing values in logical pixels into fields named
physical_width
andphysical_height
.It's not a bug though. What happens is that on window creation the windowing backend retrieves the OS scale factor (assume the user hasn't set a scalefactor override) and writes it to the
scale_factor
field. Then it multiplies the logicalphysical_width
andphysical_height
values by the scale factor to get the underlying resolution in physical pixels that the window should be created with.It's very confusing and difficult to understand from the code, particularly because the window creation backend logic is in a separate module.
What solution would you like?
My preferred API would be something like this:
What alternative(s) have you considered?
We could make
WindowResolution
into an enum instead, something like:Additional context
Some more discussion and context at #11015