Fix hi-dpi transitions on Catalina
A few issues here: First, actually wire up NativeWidgetNSWindowBridge as a DisplayObserver. In the past, it didn't matter that this code was missing, because we were getting notified via windowDidChangeBackingProperties. In Catalina, that call is happening at a different time, resulting us using an invalid cached version (which is the second issue). Second, change GetDisplayNearestWindow to call UpdateDisplaysIfNeeded. There was a bug here wherein we would return displays_[0], even if we knew (because of displays_require_update_) that that value was out of date. Thid, make GetCachedDisplayForScreen be robust to getting a surprise NSScreen* that we didn't know about. On Catalina, it happens that we can read -[NSScreen screens] and see that it has changed, before having received any notifications that such a change would happen (!). Fourth, listen for NSApplicationDidChangeScreenParametersNotification notifications. Just because it sounds like a healthy thing to be doing. Bug: 1021340 Change-Id: Ibe5a6469d9e2c39cd81d0fb19ee2cfe3aedb1488 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1902508Reviewed-by:Elly Fong-Jones <ellyjones@chromium.org> Commit-Queue: ccameron <ccameron@chromium.org> Cr-Commit-Position: refs/heads/master@{#713490}
Showing
Please register or sign in to comment