integrated-title-bar: Remove macos button style

macos uses native buttons
This commit is contained in:
YuraIz authored and Wez Furlong committed 2023-03-31 19:45:28 -07:00
1 parent e354791c34
commit baebf907f6
2 files changed
+2 -84

No files matched your search

+1 -73
View File
@@ -145,26 +145,6 @@ const PLUS_BUTTON: &[Poly] = &[
},
];
const HIDE_BUTTON: &[Poly] = &[Poly {
path: &[
PolyCommand::MoveTo(BlockCoord::Zero, BlockCoord::One),
PolyCommand::LineTo(BlockCoord::One, BlockCoord::One),
],
intensity: BlockAlpha::Full,
style: PolyStyle::Outline,
}];
const MAXIMIZE_BUTTON: &[Poly] = &[Poly {
path: &[
PolyCommand::LineTo(BlockCoord::Zero, BlockCoord::One),
PolyCommand::LineTo(BlockCoord::One, BlockCoord::One),
PolyCommand::LineTo(BlockCoord::One, BlockCoord::Zero),
PolyCommand::LineTo(BlockCoord::Zero, BlockCoord::Zero),
],
intensity: BlockAlpha::Full,
style: PolyStyle::Outline,
}];
mod window_buttons {
use super::*;
pub(super) mod windows {
@@ -342,22 +322,11 @@ fn window_button_element(
_ => unreachable!(),
}
}
Style::MacOs => match window_button {
TabBarItem::WindowHideButton => HIDE_BUTTON,
TabBarItem::WindowMaximizeButton => MAXIMIZE_BUTTON,
TabBarItem::WindowCloseButton => X_BUTTON,
_ => unreachable!(),
},
};
let poly = match style {
Style::Windows => window_buttons::windows::sized_poly(poly),
Style::Gnome => window_buttons::gnome::sized_poly(poly),
Style::MacOs => SizedPoly {
poly: &[],
width: Dimension::Pixels(13.),
height: Dimension::Pixels(13.),
},
};
let element = Element::new(
@@ -424,45 +393,6 @@ fn window_button_element(
top: Dimension::Pixels(7.),
bottom: Dimension::Pixels(7.),
}),
Style::MacOs => element
.zindex(1)
.vertical_align(VerticalAlign::Middle)
.padding(BoxDimension {
left: Dimension::default(),
right: Dimension::default(),
top: Dimension::default(),
bottom: Dimension::default(),
})
.border(BoxDimension::new(Dimension::Pixels(1.)))
.border_corners(Some(Corners {
top_left: SizedPoly {
width: Dimension::Pixels(8.),
height: Dimension::Pixels(8.),
poly: TOP_LEFT_ROUNDED_CORNER,
},
top_right: SizedPoly {
width: Dimension::Pixels(8.),
height: Dimension::Pixels(8.),
poly: TOP_RIGHT_ROUNDED_CORNER,
},
bottom_left: SizedPoly {
width: Dimension::Pixels(8.),
height: Dimension::Pixels(8.),
poly: BOTTOM_LEFT_ROUNDED_CORNER,
},
bottom_right: SizedPoly {
width: Dimension::Pixels(8.),
height: Dimension::Pixels(8.),
poly: BOTTOM_RIGHT_ROUNDED_CORNER,
},
}))
.margin(BoxDimension {
left: Dimension::Cells(0.5),
right: Dimension::Cells(0.5),
top: Dimension::Cells(0.5),
bottom: Dimension::Cells(0.5),
}),
};
let (color, hover_colors) = match window_button {
@@ -1183,9 +1113,7 @@ impl super::TermWindow {
TabBarItem::WindowHideButton
| TabBarItem::WindowMaximizeButton
| TabBarItem::WindowCloseButton => {
if (self.config.fancy_window_decorations.is_left || cfg!(target_os = "macos"))
&& cfg!(not(windows))
{
if self.config.fancy_window_decorations.is_left && cfg!(not(windows)) {
left_eles.push(item_to_elem(item))
} else {
right_eles.push(item_to_elem(item))
+1 -11
View File
@@ -1491,11 +1491,10 @@ impl Default for FancyWindowDecorations {
#[dynamic(try_from = "String")]
pub enum FancyWindowDecorationsStyle {
Windows,
MacOs,
Gnome,
}
#[cfg(any(windows, target_os = "freebsd"))]
#[cfg(not(target_os = "linux"))]
impl Default for FancyWindowDecorationsStyle {
fn default() -> Self {
Self::Windows
@@ -1509,18 +1508,10 @@ impl Default for FancyWindowDecorationsStyle {
}
}
#[cfg(target_os = "macos")]
impl Default for FancyWindowDecorationsStyle {
fn default() -> Self {
Self::MacOs
}
}
impl Into<String> for FancyWindowDecorationsStyle {
fn into(self) -> String {
match self {
Self::Windows => "windows",
Self::MacOs => "macos",
Self::Gnome => "gnome",
}
.to_string()
@@ -1532,7 +1523,6 @@ impl TryFrom<String> for FancyWindowDecorationsStyle {
fn try_from(value: String) -> Result<Self, Self::Error> {
match value.to_lowercase().as_str() {
"windows" => Ok(Self::Windows),
"macos" => Ok(Self::MacOs),
"gnome" => Ok(Self::Gnome),
_ => Err(format!("invalid fancy_window_decoratins.style {}", value)),
}