mirror of
https://github.com/wez/wezterm.git
synced 2024-09-11 14:25:57 +03:00
Adding an option (disabled by default) to disable the notch avoidance so you can use the full screen if your terminal config already handles the notch.
This commit is contained in:
parent
552bb1d66b
commit
1e94c95462
@ -715,6 +715,9 @@ pub struct Config {
|
||||
#[dynamic(default)]
|
||||
pub native_macos_fullscreen_mode: bool,
|
||||
|
||||
#[dynamic(default)]
|
||||
pub macos_fullscreen_extend_behind_notch: bool,
|
||||
|
||||
#[dynamic(default = "default_word_boundary")]
|
||||
pub selection_word_boundary: String,
|
||||
|
||||
|
@ -879,42 +879,44 @@ impl WindowOps for Window {
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let border_dimensions =
|
||||
if window_state.contains(WindowState::FULL_SCREEN) && !native_full_screen {
|
||||
let main_screen = unsafe { NSScreen::mainScreen(nil) };
|
||||
let has_safe_area_insets: BOOL =
|
||||
unsafe { msg_send![main_screen, respondsToSelector: sel!(safeAreaInsets)] };
|
||||
if has_safe_area_insets == YES {
|
||||
#[derive(Debug)]
|
||||
struct NSEdgeInsets {
|
||||
top: CGFloat,
|
||||
left: CGFloat,
|
||||
bottom: CGFloat,
|
||||
right: CGFloat,
|
||||
}
|
||||
let insets: NSEdgeInsets = unsafe { msg_send![main_screen, safeAreaInsets] };
|
||||
log::trace!("{:?}", insets);
|
||||
|
||||
let scale = unsafe {
|
||||
let frame = NSScreen::frame(main_screen);
|
||||
let backing_frame = NSScreen::convertRectToBacking_(main_screen, frame);
|
||||
backing_frame.size.height / frame.size.height
|
||||
};
|
||||
|
||||
let top = (insets.top.ceil() * scale) as usize;
|
||||
Some(Border {
|
||||
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),
|
||||
color: crate::color::LinearRgba::with_components(0., 0., 0., 1.),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
let border_dimensions = if window_state.contains(WindowState::FULL_SCREEN)
|
||||
&& !native_full_screen
|
||||
&& !_config.macos_fullscreen_extend_behind_notch
|
||||
{
|
||||
let main_screen = unsafe { NSScreen::mainScreen(nil) };
|
||||
let has_safe_area_insets: BOOL =
|
||||
unsafe { msg_send![main_screen, respondsToSelector: sel!(safeAreaInsets)] };
|
||||
if has_safe_area_insets == YES {
|
||||
#[derive(Debug)]
|
||||
struct NSEdgeInsets {
|
||||
top: CGFloat,
|
||||
left: CGFloat,
|
||||
bottom: CGFloat,
|
||||
right: CGFloat,
|
||||
}
|
||||
let insets: NSEdgeInsets = unsafe { msg_send![main_screen, safeAreaInsets] };
|
||||
log::trace!("{:?}", insets);
|
||||
|
||||
let scale = unsafe {
|
||||
let frame = NSScreen::frame(main_screen);
|
||||
let backing_frame = NSScreen::convertRectToBacking_(main_screen, frame);
|
||||
backing_frame.size.height / frame.size.height
|
||||
};
|
||||
|
||||
let top = (insets.top.ceil() * scale) as usize;
|
||||
Some(Border {
|
||||
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),
|
||||
color: crate::color::LinearRgba::with_components(0., 0., 0., 1.),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(Some(Parameters {
|
||||
title_bar: TitleBar {
|
||||
|
Loading…
Reference in New Issue
Block a user