SessionCtl // Add isBootingUp().
This commit is contained in:
parent
45c8620c01
commit
cbdcb1a7c8
|
@ -58,6 +58,16 @@ public class SessionCtl: IMKInputController {
|
|||
/// 用來標記當前副本是否已處於活動狀態。
|
||||
public var isActivated = false
|
||||
|
||||
/// 用来記錄當前副本是否處於開機階段(activateServer 執行後 0.1 秒以內都算)。
|
||||
public private(set) var isBootingUp: Bool = true {
|
||||
didSet {
|
||||
guard isBootingUp else { return }
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.isBootingUp = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 當前副本的客體是否是輸入法本體?
|
||||
public var isServingIMEItself: Bool = false
|
||||
|
||||
|
@ -274,6 +284,7 @@ public extension SessionCtl {
|
|||
/// - Parameter sender: 呼叫了該函式的客體。
|
||||
override func activateServer(_ sender: Any!) {
|
||||
super.activateServer(sender)
|
||||
isBootingUp = true
|
||||
DispatchQueue.main.async { [self] in
|
||||
if let senderBundleID: String = (sender as? IMKTextInput)?.bundleIdentifier() {
|
||||
vCLog("activateServer(\(senderBundleID))")
|
||||
|
|
|
@ -183,7 +183,7 @@ public extension SessionCtl {
|
|||
/// 雖然所有在這個函式內影響到的變數都改為動態變數了(不會出現跨副本波及的情況),
|
||||
/// 但 IMKCandidates 是有內部共用副本的、會被波及。所以在這裡糾偏一下。
|
||||
internal func keepIMKCandidatesShownUp() {
|
||||
guard PrefMgr.shared.useIMKCandidateWindow else { return }
|
||||
guard PrefMgr.shared.useIMKCandidateWindow, isBootingUp else { return }
|
||||
guard let imkC = candidateUI as? CtlCandidateIMK else { return }
|
||||
var i: Double = 0
|
||||
while i < 1 {
|
||||
|
|
Loading…
Reference in New Issue