From ed84c613a046848de09af08330ca31b942ab67ba Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 6 Mar 2023 18:04:19 +0800 Subject: [PATCH] TooltipUI // Add round window corners. * Note: This is not migratable to macOS 10.9 (plus that it is meaningless to test for macOS 10.10 - 10.12), hence the decision that this feature will be offered to the mainstream releases only. --- .../Sources/TooltipUI/TooltipUI.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift b/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift index ffadcc99..920434fd 100644 --- a/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift +++ b/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift @@ -36,10 +36,14 @@ public class TooltipUI: NSWindowController { ) panel.level = NSWindow.Level(Int(max(CGShieldingWindowLevel(), kCGPopUpMenuWindowLevel)) + 2) panel.hasShadow = true - panel.backgroundColor = NSColor.controlBackgroundColor + panel.backgroundColor = NSColor.clear + panel.isOpaque = false panel.isMovable = false + panel.contentView?.wantsLayer = true + panel.contentView?.layer?.cornerRadius = 7 + panel.contentView?.layer?.backgroundColor = NSColor.controlBackgroundColor.cgColor messageText = NSAttributedTooltipTextView() - messageText.backgroundColor = NSColor.controlBackgroundColor + messageText.backgroundColor = NSColor.clear messageText.textColor = NSColor.textColor messageText.needsDisplay = true panel.contentView?.addSubview(messageText) @@ -118,8 +122,7 @@ public class TooltipUI: NSWindowController { textColor = colorInterchange } } - window?.backgroundColor = backgroundColor - messageText.backgroundColor = backgroundColor + window?.contentView?.layer?.backgroundColor = backgroundColor.cgColor messageText.textColor = textColor }