rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.84k stars 902 forks source link

Use viewDidChangeBackingProperties on MacOS to detect when the DPI / monitor has changed #441

Closed fschutt closed 6 years ago

fschutt commented 6 years ago

I came across this interesting blog post: http://supermegaultragroovy.com/2012/10/24/coding-for-high-resolution-on-os-x-read-this/

It seems that macOS can call an application when the DPI or the monitor changes, given that viewDidChangeBackingProperties is implemented. In these cases, glium should emit a HiDPIFactorChanged event, so that the application knows that it should update the DPI.

sodiumjoe commented 6 years ago

I've implemented this in #443 using windowDidChangeBackingProperties according to https://developer.apple.com/documentation/appkit/nswindowdelegate/1419517-windowdidchangebackingproperties instead of viewDidChangeBackingProperties.