-
Notifications
You must be signed in to change notification settings - Fork 1.2k
On Windows, Window size is set incorrectly on HiDPI displays #923
Copy link
Copy link
Closed
Labels
D - easyLikely easier than most tasks hereLikely easier than most tasks hereDS - win32Affects the Win32/Windows backendAffects the Win32/Windows backendH - good first issueIdeal for new contributorsIdeal for new contributors
Description
On Windows 10, this can be replicated by setting the scaling ratio greater than 100% in Display settings and running the following example:
extern crate winit;
use winit::window::WindowBuilder;
use winit::event::{Event, WindowEvent};
use winit::event_loop::{EventLoop, ControlFlow};
fn main() {
let event_loop = EventLoop::new();
let window = WindowBuilder::new()
.with_title("A fantastic window!")
.with_inner_size(winit::dpi::LogicalSize::new(128.0, 128.0))
.build(&event_loop)
.unwrap();
println!("{:?}", window.inner_size());
event_loop.run(|event, _, control_flow| {
match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => *control_flow = ControlFlow::Exit,
_ => *control_flow = ControlFlow::Wait,
}
});
}With 150% scaling, the window gets created with a size of LogicalSize { width: 124.0, height: 116.66666666666667 }, instead of the expected LogicalSize { width: 128.0, height: 128.0 }.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
D - easyLikely easier than most tasks hereLikely easier than most tasks hereDS - win32Affects the Win32/Windows backendAffects the Win32/Windows backendH - good first issueIdeal for new contributorsIdeal for new contributors