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

High-Density Display support on MSW #1934

Merged
merged 15 commits into from Nov 27, 2017

Conversation

Projects
None yet
1 participant
@andrewfb
Collaborator

andrewfb commented Nov 21, 2017

This PR implements high-density display support on Windows Desktop, providing similar behavior to macOS and iOS retina support in earlier versions of Cinder. A few key points:

  • Prior to this PR, if a display had a scaling other than 100% applied, Cinder apps would be pixel-scaled by Windows, which is almost never desirable.
  • With this PR, an app which is not DPI aware automatically "thinks" in pixels and avoids pixel-scaling.
  • An app can opt-in to DPI awareness via Settings::setHighDensityDisplayEnabled(). After doing so, all window sizes and events are measured in points, which are DPI-scaled pixel measurements.
  • The HighDensityDisplay sample (née RetinaSample) demonstrates the basics.

This PR adds a Display::getContentScale() method, which works on Windows 8.1+. Equivalent methods on Window, as well as the convenience methods toPixels() and toPoints() are usable when an app has opted-in to DPI awareness.

This PR also modifies the App::DisplayChanged signal to emit when a user changes the DPI on a display.

Also to reiterate, unlike macOS/iOS, DPI-unawareness in Windows defaults to pixels measurements but not pixel-scaling. In contrast, DPI-unawareness on Apple platforms leads to pixel-scaling. I don't love this inconsistency but I believe for the average MSW user / application, pixel-centricity is the preferred unaware / don't care behavior.

@andrewfb andrewfb merged commit e6e1a8d into cinder:master Nov 27, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment