Merge pull request #3603 from haikusw/bug3543

Fixes #3543
This commit is contained in:
Maurice Parker
2022-06-21 12:21:12 -06:00
committed by GitHub

View File

@@ -65,6 +65,7 @@ final class DetailWebView: WKWebView {
private var inBigSurOffsetFix = false
@available(macOS, obsoleted: 12, message: "when minimum deployment > macOS 11 remove bigSurOffsetFix() and calls to it.")
private func bigSurOffsetFix() {
/*
On macOS 11, when a user exits full screen
@@ -73,25 +74,30 @@ final class DetailWebView: WKWebView {
This code adjusts the height of the window by -1pt/+1pt,
which puts the webview back in the correct place.
This code is only executed if currently running on macOS 11
*/
guard var frame = window?.frame else {
return
}
guard !inBigSurOffsetFix else {
return
}
inBigSurOffsetFix = true
defer {
inBigSurOffsetFix = false
if #unavailable(macOS 12) {
guard var frame = window?.frame else {
return
}
guard !inBigSurOffsetFix else {
return
}
inBigSurOffsetFix = true
defer {
inBigSurOffsetFix = false
}
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1)
window!.setFrame(frame, display: false)
frame.size = NSSize(width: frame.width, height: frame.height + 1)
window!.setFrame(frame, display: false)
}
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1)
window!.setFrame(frame, display: false)
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height + 1)
window!.setFrame(frame, display: false)
}
}