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

windows-only function for setting DPI #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Apocalyptapig
Copy link

@Apocalyptapig Apocalyptapig commented Jan 14, 2023

for use with higher-res monitors - adds winit as a dependency for getting DPI

(first pr, apologies if this isn't the right way)

@fayez-nazzal
Copy link
Owner

Thank you for the contribution, let me check it on my windows machine in my free time :)


[dependencies]
winapi = "0.3.9"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

winapi should not be a global dependency because it is target specific

[dependencies]
winapi = "0.3.9"
winit = "0.27.5"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a way to extract the data you need without using winit, check the winit source, you might find something there. I say this because the mouse_position library is a read library without dependencies to rendering libraries like winit and this can be a problem in certain use cases

Comment on lines +25 to +28
use winit::event_loop::EventLoop;

// forgive me
let mut monitors = (*EventLoop::new()).available_monitors();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part you can do it with the simple winapi, you don't need to use winit (although I understand how simple it can be), anyway I previously recommended to look at the implementation of winit, here is the way they do it

https://github.com/rust-windowing/winit/blob/master/src/platform_impl/windows/monitor.rs#L108-L119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants