SessionCtl // Keep IMKCandidates shown when needed.

This commit is contained in:
ShikiSuen 2023-06-10 16:30:25 +08:00
parent e773ae759c
commit 05213c04b1
3 changed files with 18 additions and 9 deletions

View File

@ -167,15 +167,6 @@ public class SessionCtl: IMKInputController {
/// ///
syncBaseLMPrefs() syncBaseLMPrefs()
} }
// deactivateServer() activateServer()
//
// IMKCandidates
if PrefMgr.shared.useIMKCandidateWindow {
guard let imkC = candidateUI as? CtlCandidateIMK else { return }
if state.isCandidateContainer, !imkC.visible {
handle(state: state, replace: false)
}
}
} }
} }

View File

@ -74,6 +74,7 @@ public extension SessionCtl {
func showCandidates() { func showCandidates() {
guard client() != nil else { return } guard client() != nil else { return }
defer { keepIMKCandidatesShownUp() }
updateVerticalTypingStatus() updateVerticalTypingStatus()
isVerticalCandidateWindow = (isVerticalTyping || !PrefMgr.shared.useHorizontalCandidateList) isVerticalCandidateWindow = (isVerticalTyping || !PrefMgr.shared.useHorizontalCandidateList)

View File

@ -169,4 +169,21 @@ public extension SessionCtl {
} }
} }
} }
/// deactivateServer() activateServer()
///
/// IMKCandidates
internal func keepIMKCandidatesShownUp() {
guard PrefMgr.shared.useIMKCandidateWindow else { return }
guard let imkC = candidateUI as? CtlCandidateIMK else { return }
var i: Double = 0
while i < 1 {
DispatchQueue.main.asyncAfter(deadline: .now() + i) { [self] in
if state.isCandidateContainer, !imkC.visible {
imkC.visible = true
}
}
i += 0.3
}
}
} }