From 8ba0ef2375d096f8f537481fc76fdf03b561c5ff Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Fri, 1 Apr 2022 08:14:11 -0700 Subject: [PATCH] macos: notch avoidance tweak https://github.com/wez/wezterm/issues/1737#issuecomment-1085923867 --- window/src/os/macos/window.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 6ff759507..198ec7da4 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -712,8 +712,18 @@ impl WindowOps for Window { } let insets: NSEdgeInsets = unsafe { msg_send![main_screen, safeAreaInsets] }; log::trace!("{:?}", insets); + + // Bleh, the API is supposed to give us the right metrics, but it needs + // a tweak to look good around the notch. + // + let top = insets.top.ceil() as usize; + let top = if top > 0 { + top + 2 + } else { + 0 + }; Some(Border { - top: ULength::new(insets.top.ceil() as usize), + top: ULength::new(top), left: ULength::new(insets.left.ceil() as usize), right: ULength::new(insets.right.ceil() as usize), bottom: ULength::new(insets.bottom.ceil() as usize),