Skip to content

Commit

Permalink
feat(macOS): add support to disable rounded corners on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
amadeusdotpng committed Jan 20, 2025
1 parent 6c443be commit adfb84a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion wezterm-input-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1975,7 +1975,8 @@ bitflags! {
// so that we effective have Option<bool>
const MACOS_FORCE_DISABLE_SHADOW = 4;
const MACOS_FORCE_ENABLE_SHADOW = 4|8;
const INTEGRATED_BUTTONS = 16;
const MACOS_FORCE_SQUARE_CORNERS = 16;
const INTEGRATED_BUTTONS = 32;
}
}

Expand All @@ -1995,6 +1996,8 @@ impl Into<String> for &WindowDecorations {
s.push("MACOS_FORCE_ENABLE_SHADOW");
} else if self.contains(WindowDecorations::MACOS_FORCE_DISABLE_SHADOW) {
s.push("MACOS_FORCE_DISABLE_SHADOW");
} else if self.contains(WindowDecorations::MACOS_FORCE_SQUARE_CORNERS) {
s.push("MACOS_FORCE_SQUARE_CORNERS");
}
if s.is_empty() {
"NONE".to_string()
Expand All @@ -2020,6 +2023,8 @@ impl TryFrom<String> for WindowDecorations {
flags |= Self::MACOS_FORCE_DISABLE_SHADOW;
} else if ele == "MACOS_FORCE_ENABLE_SHADOW" {
flags |= Self::MACOS_FORCE_ENABLE_SHADOW;
} else if ele == "MACOS_FORCE_SQUARE_CORNERS" {
flags |= Self::MACOS_FORCE_SQUARE_CORNERS;
} else if ele == "INTEGRATED_BUTTONS" {
flags |= Self::INTEGRATED_BUTTONS;
} else {
Expand Down
9 changes: 9 additions & 0 deletions window/src/os/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,11 @@ fn decoration_to_mask(
| NSWindowStyleMask::NSClosableWindowMask
| NSWindowStyleMask::NSMiniaturizableWindowMask
| NSWindowStyleMask::NSResizableWindowMask
} else if decorations == WindowDecorations::MACOS_FORCE_SQUARE_CORNERS | WindowDecorations::RESIZE {
NSWindowStyleMask::NSClosableWindowMask
| NSWindowStyleMask::NSMiniaturizableWindowMask
| NSWindowStyleMask::NSResizableWindowMask
| NSWindowStyleMask::NSFullSizeContentViewWindowMask
} else if decorations == WindowDecorations::RESIZE
|| decorations == WindowDecorations::INTEGRATED_BUTTONS
|| decorations == WindowDecorations::INTEGRATED_BUTTONS | WindowDecorations::RESIZE
Expand All @@ -1393,6 +1398,10 @@ fn decoration_to_mask(
NSWindowStyleMask::NSTitledWindowMask
| NSWindowStyleMask::NSClosableWindowMask
| NSWindowStyleMask::NSMiniaturizableWindowMask
} else if decorations == WindowDecorations::MACOS_FORCE_SQUARE_CORNERS {
NSWindowStyleMask::NSClosableWindowMask
| NSWindowStyleMask::NSMiniaturizableWindowMask
| NSWindowStyleMask::NSFullSizeContentViewWindowMask
} else {
NSWindowStyleMask::NSTitledWindowMask
| NSWindowStyleMask::NSClosableWindowMask
Expand Down

0 comments on commit adfb84a

Please sign in to comment.