Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Cursor Position Inaccurate #62

Closed
tomaka opened this issue Nov 3, 2016 · 2 comments · Fixed by #548
Closed

Setting Cursor Position Inaccurate #62

tomaka opened this issue Nov 3, 2016 · 2 comments · Fixed by #548
Labels
B - bug Dang, that shouldn't have happened C - in progress Implementation is proceeding smoothly D - hard Likely harder than most tasks here DS - windows P - high Vital to have
Milestone

Comments

@tomaka
Copy link
Contributor

tomaka commented Nov 3, 2016

Original: rust-windowing/glutin#663

@paulirotta
Copy link
Contributor

This may be the same issue I'm seeing with Windows 10 DPI awareness settings. I think the solution is something along the lines of SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE) to get Windows to give 1:1 on virtual pixels and real pixels. Some APIs use scaled pixels, some not...
https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dn302122(v=vs.85).aspx

(Related?) app-level hack, Vulkano on Windows with 250% scaling (high DPI laptop):
// Hack to make Vulkano window the same size as the screen when scaling is 250%
let monitor_id: winit::MonitorId = {
//TODO Find the most appropriate monitor, for example the one selected last time
for (num, monitor) in winit::get_available_monitors().enumerate() {
println!("Monitor #{}: {:?} {:?}", num, monitor.get_name(), monitor.get_dimensions());
}
let num = 0;
let monitor = winit::get_available_monitors().nth(num).expect("Invalid monitor ID");
monitor
};
let monitor_dimensions = monitor_id.get_dimensions();
let k = (10, 25); // 2.5 safe integer division
*** let window_dimensions = (monitor_dimensions.0 k.0/k.1, monitor_dimensions.1k.0/k.1); ***
let window = winit::WindowBuilder::new()
.with_title("Slice")
.with_multitouch()
.with_dimensions(window_dimensions.0, window_dimensions.1)
.with_decorations(true)
.build_vk_surface(&instance)
.expect("Could not build Vulkan window");

jrmuizel pushed a commit to jrmuizel/winit that referenced this issue Mar 29, 2017
@LPGhatguy
Copy link
Contributor

LPGhatguy commented May 22, 2017

I'm going to give this issue a try, as I hit the hidpi inaccuracy the other day.

To be backwards compatible with Windows Vista and 7, you can pass TRUE to SetProcessDpiAwareness to be per-monitor DPI aware on 8.1+ and system API aware on 8-. EDIT: Shcore.dll isn't present on Windows 8 and older, need to dynamically link against it

@francesca64 francesca64 added B - bug Dang, that shouldn't have happened C - in progress Implementation is proceeding smoothly D - hard Likely harder than most tasks here P - high Vital to have labels May 6, 2018
@francesca64 francesca64 added this to the HiDPI Support milestone May 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened C - in progress Implementation is proceeding smoothly D - hard Likely harder than most tasks here DS - windows P - high Vital to have
Development

Successfully merging a pull request may close this issue.

4 participants