Permalink
Browse files

Recover configuration

  • Loading branch information...
youknowone committed Sep 4, 2018
1 parent 3d4435c commit 3adb9f17fef2f9519be41e53b3fe9dba12f0e50b
Showing with 16 additions and 19 deletions.
  1. +2 −2 GureumTests/GureumTests.m
  2. +0 −1 OSX/GureumAppDelegate.swift
  3. +3 −2 OSX/GureumComposer.m
  4. +11 −14 OSX/GureumConfiguration.swift
@@ -196,8 +196,8 @@ - (void)testLayoutChange {
[app.controller setValue:kGureumInputSourceIdentifierQwerty forTag:kTextServiceInputModePropertyTag client:app.client];
[app inputText:nil key:-1 modifiers:NSAlphaShiftKeyMask];
[app inputText:@" " key:49 modifiers:131072];
[app inputText:@" " key:49 modifiers:131072];
[app inputText:@" " key:kVK_Space modifiers:NSShiftKeyMask];
[app inputText:@" " key:kVK_Space modifiers:NSShiftKeyMask];
XCTAssertEqualObjects(@"", app.client.string, @"buffer: %@ app: (%@)", app.client.string, app);
}
}
@@ -23,7 +23,6 @@ import Foundation
HGKeyboard.initialize()
_sharedInputManager = CIMInputManager()
guard let info = (NSApp.delegate as! GureumAppDelegate).getRecentVersion() else {
return
}
View
@@ -103,6 +103,7 @@ - (void)setInputMode:(NSString *)newInputMode {
}
- (CIMInputTextProcessResult)inputController:(CIMInputController *)controller commandString:(NSString *)string key:(NSInteger)keyCode modifiers:(NSEventModifierFlags)flags client:(id)sender {
GureumConfiguration *configuration = [GureumConfiguration shared];
NSInteger inputModifier = flags & NSDeviceIndependentModifierFlagsMask & ~NSAlphaShiftKeyMask;
BOOL need_exchange = NO;
BOOL need_hanjamode = NO;
@@ -167,7 +168,7 @@ - (CIMInputTextProcessResult)inputController:(CIMInputController *)controller co
dlog(1, @"%s input modifier : %lx", __func__, inputModifier);
}
if (inputModifier == [GureumConfiguration shared].inputModeExchangeKeyModifier && keyCode == [GureumConfiguration shared].inputModeExchangeKeyCode) {
if (inputModifier == configuration.inputModeExchangeKeyModifier && keyCode == configuration.inputModeExchangeKeyCode) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by exchange shortcut ****");
need_exchange = YES;
}
@@ -180,7 +181,7 @@ - (CIMInputTextProcessResult)inputController:(CIMInputController *)controller co
// need_exchange = YES;
// }
if (inputModifier == [GureumConfiguration shared].inputModeHanjaKeyModifier && keyCode == [GureumConfiguration shared].inputModeHanjaKeyCode) {
if (inputModifier == configuration.inputModeHanjaKeyModifier && keyCode == configuration.inputModeHanjaKeyCode) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by hanja shortcut ****");
need_hanjamode = YES;
}
@@ -7,6 +7,7 @@
//
import Foundation
import AppKit
var CIMLastHangulInputMode = "CIMLastHangulInputMode"
@@ -38,13 +39,19 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
init() {
super.init(suiteName: "org.youknowone.Gureum")!
self.register(defaults: [
CIMInputModeExchangeKeyModifier: NSEvent.ModifierFlags.shift.rawValue,
CIMInputModeExchangeKeyCode: 0x31,
CIMInputModeHanjaKeyModifier: NSEvent.ModifierFlags.option.rawValue,
CIMInputModeHanjaKeyCode: 0x24,
CIMAutosaveDefaultInputMode: true,
])
}
@objc public var lastHangulInputMode: String? {
get {
return self.string(forKey: CIMLastHangulInputMode)
}
set {
return self.set(newValue, forKey: CIMLastHangulInputMode)
}
@@ -54,7 +61,6 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
get {
return self.integer(forKey: CIMOptionKeyBehavior)
}
set {
return self.set(newValue, forKey: CIMOptionKeyBehavior)
}
@@ -64,7 +70,6 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
get {
return self.integer(forKey: CIMShowsInputForHanjaCandidates)
}
set {
return self.set(newValue, forKey: CIMShowsInputForHanjaCandidates)
}
@@ -74,7 +79,6 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
get {
return self.integer(forKey: CIMHangulCombinationModeCommiting)
}
set {
return self.set(newValue, forKey: CIMHangulCombinationModeCommiting)
}
@@ -84,7 +88,6 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
get {
return self.integer(forKey: CIMHangulCombinationModeComposing)
}
set {
return self.set(newValue, forKey: CIMHangulCombinationModeComposing)
}
@@ -98,13 +101,13 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
@objc public var inputModeExchangeKeyModifier: Int {
get {
return 0
return self.integer(forKey: CIMInputModeExchangeKeyModifier)
}
}
@objc public var inputModeExchangeKeyCode: Int {
get {
return 50
return self.integer(forKey: CIMInputModeExchangeKeyCode)
}
}
@@ -118,19 +121,15 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
get {
return self.integer(forKey: CIMInputModeHanjaKeyModifier)
}
set {
return self.set(newValue, forKey: CIMInputModeHanjaKeyModifier)
}
}
@objc public var inputModeHanjaKeyCode: Int {
get {
return -9
// 한자 키코드가 기본 값인 0 ("a" 키에 해당)으로 설정되어 임시로 주석 처리했습니다.
// return self.integer(forKey: CIMInputModeHanjaKeyCode)
return self.integer(forKey: CIMInputModeHanjaKeyCode)
}
set {
return self.set(newValue, forKey: CIMInputModeHanjaKeyCode)
}
@@ -140,7 +139,6 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
get {
return self.integer(forKey: CIMRomanModeByEscapeKey);
}
set {
return self.set(newValue, forKey: CIMRomanModeByEscapeKey)
}
@@ -150,7 +148,6 @@ var CIMShowsInputForHanjaCandidates = "CIMShowsInputForHanjaCandidates"
get {
return self.integer(forKey: CIMAutosaveDefaultInputMode);
}
set {
return self.set(newValue, forKey: CIMAutosaveDefaultInputMode)
}

0 comments on commit 3adb9f1

Please sign in to comment.