diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift index 6a0f85ac..829b0ba0 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift @@ -63,7 +63,6 @@ public class CtlCandidateTDK: CtlCandidate { panel.hasShadow = true panel.isOpaque = false panel.backgroundColor = NSColor.clear - contentRect.origin = NSPoint.zero super.init(layout) @@ -104,33 +103,34 @@ public class CtlCandidateTDK: CtlCandidate { } override open func updateDisplay() { + guard let window = window else { return } switch currentLayout { case .horizontal: DispatchQueue.main.async { [self] in if #available(macOS 12, *) { - let newView = NSHostingView(rootView: theViewHorizontal) + let newView = NSHostingView(rootView: theViewHorizontal.edgesIgnoringSafeArea(.top)) let newSize = newView.fittingSize - window?.contentView = newView - window?.setContentSize(newSize) + window.contentView = newView + window.setContentSize(newSize) } else { - let newView = NSHostingView(rootView: theViewHorizontalBackports) + let newView = NSHostingView(rootView: theViewHorizontalBackports.edgesIgnoringSafeArea(.top)) let newSize = newView.fittingSize - window?.contentView = newView - window?.setContentSize(newSize) + window.contentView = newView + window.setContentSize(newSize) } } case .vertical: DispatchQueue.main.async { [self] in if #available(macOS 12, *) { - let newView = NSHostingView(rootView: theViewVertical) + let newView = NSHostingView(rootView: theViewVertical.edgesIgnoringSafeArea(.top)) let newSize = newView.fittingSize - window?.contentView = newView - window?.setContentSize(newSize) + window.contentView = newView + window.setContentSize(newSize) } else { - let newView = NSHostingView(rootView: theViewVerticalBackports) + let newView = NSHostingView(rootView: theViewVerticalBackports.edgesIgnoringSafeArea(.top)) let newSize = newView.fittingSize - window?.contentView = newView - window?.setContentSize(newSize) + window.contentView = newView + window.setContentSize(newSize) } } @unknown default: diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateHorizontal.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateHorizontal.swift index cfbdda1e..7c2976f1 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateHorizontal.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateHorizontal.swift @@ -100,11 +100,13 @@ public struct VwrCandidateHorizontal: View { .lineLimit( 1) } - .padding(6).foregroundColor( + .padding(7).foregroundColor( .init(nsColor: tooltip.isEmpty ? .controlTextColor : .selectedMenuItemTextColor.withAlphaComponent(0.9)) ) } + .fixedSize(horizontal: false, vertical: true) } .frame(minWidth: thePool.maxWindowWidth, maxWidth: thePool.maxWindowWidth) + .cornerRadius(10) } } diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateVertical.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateVertical.swift index 46f6ec4b..87949c8c 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateVertical.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/VwrCandidateVertical.swift @@ -105,10 +105,11 @@ public struct VwrCandidateVertical: View { .lineLimit( 1) } - .padding(6).foregroundColor( + .padding(7).foregroundColor( .init(nsColor: tooltip.isEmpty ? .controlTextColor : .selectedMenuItemTextColor.withAlphaComponent(0.9)) ) } } + .cornerRadius(10) } } diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateHorizontalBackports.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateHorizontalBackports.swift index efedab54..8b70b578 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateHorizontalBackports.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateHorizontalBackports.swift @@ -105,11 +105,13 @@ public struct VwrCandidateHorizontalBackports: View { .lineLimit( 1) } - .padding(6).foregroundColor( + .padding(7).foregroundColor( tooltip.isEmpty && colorScheme == .light ? Color(white: 0.1) : Color(white: 0.9) ) } + .fixedSize(horizontal: false, vertical: true) } .frame(minWidth: thePool.maxWindowWidth, maxWidth: thePool.maxWindowWidth) + .cornerRadius(10) } } diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateVerticalBackports.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateVerticalBackports.swift index 30ea03e7..0b30fa87 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateVerticalBackports.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates_Backports/VwrCandidateVerticalBackports.swift @@ -110,10 +110,11 @@ public struct VwrCandidateVerticalBackports: View { .lineLimit( 1) } - .padding(6).foregroundColor( + .padding(7).foregroundColor( tooltip.isEmpty && colorScheme == .light ? Color(white: 0.1) : Color(white: 0.9) ) } } + .cornerRadius(10) } }