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

Retrieve DPI scale from window instead of screen #439

Merged
merged 1 commit into from
May 27, 2024

Conversation

jack-cooper
Copy link
Contributor

Previously, DPI scale was retrieved based on the property from the screen. This PR changes this behaviour to instead retrieve it from the window. Previous behaviour on a macbook could result in a 3:2 ratio between the reported DPI scale and the window size:

WIth high_dpi: false:
screen_size() returns (1440.0, 900.0)
dpi_scale() returns 1.0

With high_dpi: true:
screen_size() returns (2880.0, 1800.0)
dpi_scale() returns 3.0 sometimes and 2.0 somtimes.

The apple docs provide virtually no guarantees for the backingScaleFactor property for NSScreen, while the same documentation for NSWindow explicitly states the returned value is either 2.0 or 1.0. This seems to always line up with the value returned by screen_size, and intuitively I would also expect the value for the window to be of more interest to miniquad than that of the display.

@not-fl3 not-fl3 merged commit deb13e3 into not-fl3:master May 27, 2024
10 checks passed
@not-fl3
Copy link
Owner

not-fl3 commented May 27, 2024

Thanks for PR!

@jack-cooper jack-cooper deleted the fix/dpi_scale branch May 27, 2024 13:57
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.

2 participants