diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift index 9464f660..5884b331 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift @@ -74,7 +74,7 @@ public class CtlCandidateTDK: CtlCandidate { let panel = NSPanel( contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false ) - panel.level = NSWindow.Level(Int(kCGPopUpMenuWindowLevel) + 2) + panel.level = NSWindow.Level(Int(max(CGShieldingWindowLevel(), kCGPopUpMenuWindowLevel)) + 2) panel.hasShadow = true panel.isOpaque = false panel.backgroundColor = NSColor.clear diff --git a/Packages/vChewing_NotifierUI/Sources/NotifierUI/NotifierUI.swift b/Packages/vChewing_NotifierUI/Sources/NotifierUI/NotifierUI.swift index 2e623d58..96352b71 100644 --- a/Packages/vChewing_NotifierUI/Sources/NotifierUI/NotifierUI.swift +++ b/Packages/vChewing_NotifierUI/Sources/NotifierUI/NotifierUI.swift @@ -97,7 +97,7 @@ public class Notifier: NSWindowController { ) theWindow.contentView = transparentVisualEffect theWindow.isMovableByWindowBackground = true - theWindow.level = NSWindow.Level(Int(kCGPopUpMenuWindowLevel)) + theWindow.level = NSWindow.Level(Int(max(CGShieldingWindowLevel(), kCGPopUpMenuWindowLevel))) theWindow.hasShadow = true theWindow.backgroundColor = .textBackgroundColor theWindow.title = "" diff --git a/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift b/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift index 0cb5fb85..eff04bb9 100644 --- a/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift +++ b/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift @@ -32,7 +32,7 @@ public class PopupCompositionBuffer: NSWindowController { let panel = NSPanel( contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false ) - panel.level = NSWindow.Level(Int(kCGPopUpMenuWindowLevel) + 1) + panel.level = NSWindow.Level(Int(max(CGShieldingWindowLevel(), kCGPopUpMenuWindowLevel)) + 1) panel.hasShadow = true panel.backgroundColor = NSColor.controlBackgroundColor panel.styleMask = .fullSizeContentView diff --git a/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift b/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift index 54cee25b..f4ef26c5 100644 --- a/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift +++ b/Packages/vChewing_TooltipUI/Sources/TooltipUI/TooltipUI.swift @@ -34,7 +34,7 @@ public class TooltipUI: NSWindowController { let panel = NSPanel( contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false ) - panel.level = NSWindow.Level(Int(kCGPopUpMenuWindowLevel) + 2) + panel.level = NSWindow.Level(Int(max(CGShieldingWindowLevel(), kCGPopUpMenuWindowLevel)) + 2) panel.hasShadow = true panel.backgroundColor = NSColor.controlBackgroundColor panel.isMovable = false diff --git a/Source/Modules/SessionCtl_HandleDisplay.swift b/Source/Modules/SessionCtl_HandleDisplay.swift index cb769798..6f266226 100644 --- a/Source/Modules/SessionCtl_HandleDisplay.swift +++ b/Source/Modules/SessionCtl_HandleDisplay.swift @@ -73,7 +73,7 @@ extension SessionCtl { } public func showCandidates() { - guard let client = client() else { return } + guard client() != nil else { return } updateVerticalTypingStatus() isVerticalCandidateWindow = (isVerticalTyping || !PrefMgr.shared.useHorizontalCandidateList) @@ -127,9 +127,7 @@ extension SessionCtl { if #available(macOS 10.14, *) { // Spotlight 視窗會擋住 IMK 選字窗,所以需要特殊處理。 if let ctlCandidateCurrent = candidateUI as? CtlCandidateIMK { - while ctlCandidateCurrent.windowLevel() <= client.windowLevel() { - ctlCandidateCurrent.setWindowLevel(UInt64(max(0, client.windowLevel() + 1000))) - } + ctlCandidateCurrent.setWindowLevel(UInt64(CGShieldingWindowLevel() + 2)) } }