Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(macOS): add support to disable rounded corners on macOS #6587

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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