ctlIME & KeyHandler // Add ObjC way to know current inputMode.
- This is not recommended to use unless in rare cases that the ctlInputMethod.currentKeyHandler approach doesn't work.
This commit is contained in:
parent
d524a512fb
commit
f37cc0c3ea
|
@ -27,9 +27,9 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
|
||||||
#import "vChewing-Swift.h"
|
#import "vChewing-Swift.h"
|
||||||
#import <string>
|
#import <string>
|
||||||
|
|
||||||
InputMode imeModeCHT = @"org.atelierInmu.inputmethod.vChewing.IMECHT";
|
InputMode imeModeCHS = ctlInputMethod.kIMEModeCHS;
|
||||||
InputMode imeModeCHS = @"org.atelierInmu.inputmethod.vChewing.IMECHS";
|
InputMode imeModeCHT = ctlInputMethod.kIMEModeCHT;
|
||||||
InputMode imeModeNULL = @"org.atelierInmu.inputmethod.vChewing.IMENULL";
|
InputMode imeModeNULL = ctlInputMethod.kIMEModeNULL;
|
||||||
|
|
||||||
static const double kEpsilon = 0.000001;
|
static const double kEpsilon = 0.000001;
|
||||||
|
|
||||||
|
@ -111,6 +111,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
newUserOverrideModel = [mgrLangModel userOverrideModelCHT];
|
newUserOverrideModel = [mgrLangModel userOverrideModelCHT];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report the current Input Mode to ctlInputMethod:
|
||||||
|
ctlInputMethod.currentInputMode = newInputMode;
|
||||||
|
|
||||||
// Synchronize the Preference Setting "setPhraseReplacementEnabled" to the new LM.
|
// Synchronize the Preference Setting "setPhraseReplacementEnabled" to the new LM.
|
||||||
newLanguageModel->setPhraseReplacementEnabled(Preferences.phraseReplacementEnabled);
|
newLanguageModel->setPhraseReplacementEnabled(Preferences.phraseReplacementEnabled);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,10 @@ private extension CandidateController {
|
||||||
@objc(ctlInputMethod)
|
@objc(ctlInputMethod)
|
||||||
class ctlInputMethod: IMKInputController {
|
class ctlInputMethod: IMKInputController {
|
||||||
|
|
||||||
|
@objc static let kIMEModeCHS = "org.atelierInmu.inputmethod.vChewing.IMECHS";
|
||||||
|
@objc static let kIMEModeCHT = "org.atelierInmu.inputmethod.vChewing.IMECHT";
|
||||||
|
@objc static let kIMEModeNULL = "org.atelierInmu.inputmethod.vChewing.IMENULL";
|
||||||
|
|
||||||
private static let tooltipController = TooltipController()
|
private static let tooltipController = TooltipController()
|
||||||
|
|
||||||
// MARK: -
|
// MARK: -
|
||||||
|
@ -53,6 +57,7 @@ class ctlInputMethod: IMKInputController {
|
||||||
// 所以才需要「currentKeyHandler」這個假 keyHandler。
|
// 所以才需要「currentKeyHandler」這個假 keyHandler。
|
||||||
// 這個「currentKeyHandler」僅用來讓其他模組知道當前的輸入模式是什麼模式,除此之外別無屌用。
|
// 這個「currentKeyHandler」僅用來讓其他模組知道當前的輸入模式是什麼模式,除此之外別無屌用。
|
||||||
static var currentKeyHandler: KeyHandler = KeyHandler()
|
static var currentKeyHandler: KeyHandler = KeyHandler()
|
||||||
|
@objc static var currentInputMode = ""
|
||||||
|
|
||||||
// MARK: - IMKInputController methods
|
// MARK: - IMKInputController methods
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue