From adfb84a0b903b967458765e5a2491ad76111c022 Mon Sep 17 00:00:00 2001 From: amadeusdotpng Date: Mon, 20 Jan 2025 17:15:22 -0600 Subject: [PATCH] feat(macOS): add support to disable rounded corners on macOS --- wezterm-input-types/src/lib.rs | 7 ++++++- window/src/os/macos/window.rs | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/wezterm-input-types/src/lib.rs b/wezterm-input-types/src/lib.rs index b3298bad6aa..f43bdd57d36 100644 --- a/wezterm-input-types/src/lib.rs +++ b/wezterm-input-types/src/lib.rs @@ -1975,7 +1975,8 @@ bitflags! { // so that we effective have Option 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; } } @@ -1995,6 +1996,8 @@ impl Into 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() @@ -2020,6 +2023,8 @@ impl TryFrom 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 { diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 316968ccec0..187c6b99a5b 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -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 @@ -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