fix(macos): round chat window chrome

This commit is contained in:
Peter Steinberger
2025-12-27 02:51:59 +01:00
parent cc8e104cd6
commit e8ff08e121

View File

@@ -10,8 +10,9 @@ private let webChatSwiftLogger = Logger(subsystem: "com.steipete.clawdis", categ
private enum WebChatSwiftUILayout {
static let windowSize = NSSize(width: 1120, height: 840)
static let panelSize = NSSize(width: 560, height: 720)
static let panelSize = NSSize(width: 480, height: 640)
static let windowMinSize = NSSize(width: 960, height: 720)
static let windowInset: CGFloat = 6
static let anchorPadding: CGFloat = 8
}
@@ -313,26 +314,44 @@ final class WebChatSwiftUIWindowController {
effectView.material = .sidebar
effectView.blendingMode = .behindWindow
effectView.state = .active
effectView.translatesAutoresizingMaskIntoConstraints = true
effectView.autoresizingMask = [.width, .height]
effectView.wantsLayer = true
effectView.layer?.cornerCurve = .continuous
let cornerRadius: CGFloat = switch presentation {
case .panel:
16
case .window:
12
14
}
effectView.layer?.cornerRadius = cornerRadius
effectView.layer?.masksToBounds = true
let rootView: NSView
if case .window = presentation {
let container = NSView()
container.wantsLayer = true
container.layer?.backgroundColor = NSColor.clear.cgColor
effectView.translatesAutoresizingMaskIntoConstraints = false
container.addSubview(effectView)
NSLayoutConstraint.activate([
effectView.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: WebChatSwiftUILayout.windowInset),
effectView.trailingAnchor.constraint(equalTo: container.trailingAnchor, constant: -WebChatSwiftUILayout.windowInset),
effectView.topAnchor.constraint(equalTo: container.topAnchor, constant: WebChatSwiftUILayout.windowInset),
effectView.bottomAnchor.constraint(equalTo: container.bottomAnchor, constant: -WebChatSwiftUILayout.windowInset),
])
rootView = container
} else {
effectView.translatesAutoresizingMaskIntoConstraints = true
effectView.autoresizingMask = [.width, .height]
rootView = effectView
}
hosting.view.translatesAutoresizingMaskIntoConstraints = false
hosting.view.wantsLayer = true
hosting.view.layer?.backgroundColor = NSColor.clear.cgColor
controller.addChild(hosting)
effectView.addSubview(hosting.view)
controller.view = effectView
controller.view = rootView
NSLayoutConstraint.activate([
hosting.view.leadingAnchor.constraint(equalTo: effectView.leadingAnchor),