Permalink
Browse files

영문으로 바꾸기, 한글로 바꾸기 단축키가 오동작하는 문제 수정

fix #120
  • Loading branch information...
youknowone committed Oct 22, 2014
1 parent 31b3b41 commit ad8331a67694e870644d4d3cb703f4ecf9d8152b
Showing with 52 additions and 49 deletions.
  1. +47 −46 OSX/GureumComposer.m
  2. +5 −3 OSX/GureumPreferencesWindowController.m
View
@@ -11,7 +11,7 @@
#import "CIMConfiguration.h"
#import "GureumAppDelegate.h"
#define DEBUG_GUREUM TRUE
#define DEBUG_GUREUM FALSE
#define DEBUG_SHORTCUT FALSE
NSString *kGureumInputSourceIdentifierQwerty = @"org.youknowone.inputmethod.Gureum.qwerty";
@@ -107,53 +107,54 @@ - (void)setInputMode:(NSString *)newInputMode {
}
- (CIMInputTextProcessResult)inputController:(CIMInputController *)controller commandString:(NSString *)string key:(NSInteger)keyCode modifiers:(NSUInteger)flags client:(id)sender {
NSInteger inputModifier = flags & NSDeviceIndependentModifierFlagsMask & ~NSAlphaShiftKeyMask;
NSInteger inputModifier = flags;// & NSDeviceIndependentModifierFlagsMask & ~NSAlphaShiftKeyMask;
BOOL need_exchange = NO;
BOOL need_hanjamode = NO;
if (string == nil) {
NSUInteger modifierKey = flags & 0xff;
if (self->lastModifier != 0 && modifierKey == 0) {
dlog(DEBUG_SHORTCUT, @"**** Trigger modifier: %lx ****", self->lastModifier);
NSDictionary *correspondedConfigurations = @{
@(0x01): @(CIMSharedConfiguration->leftControlKeyShortcutBehavior),
@(0x20): @(CIMSharedConfiguration->leftOptionKeyShortcutBehavior),
@(0x08): @(CIMSharedConfiguration->leftCommandKeyShortcutBehavior),
@(0x10): @(CIMSharedConfiguration->leftCommandKeyShortcutBehavior),
@(0x40): @(CIMSharedConfiguration->leftOptionKeyShortcutBehavior),
};
for (NSNumber *marker in @[@(0x01), @(0x20), @(0x08), @(0x10), @(0x40)]) {
if (self->lastModifier == marker.unsignedIntegerValue ) {
NSInteger configuration = [correspondedConfigurations[marker] integerValue];
switch (configuration) {
case 0:
break;
case 1: {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by exchange modifier ****");
need_exchange = YES;
} break;
case 2: {
dlog(DEBUG_SHORTCUT, @"**** Hanja mode by hanja modifier ****");
need_hanjamode = YES;
} break;
case 3: if (self.delegate == self->hangulComposer) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to english modifier ****");
need_exchange = YES;
} break;
case 4: if (self.delegate == self->romanComposer) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to korean modifier ****");
need_exchange = YES;
} break;
default:
dassert(NO);
break;
}
}
}
} else {
self->lastModifier = modifierKey;
dlog(DEBUG_SHORTCUT, @"**** Save modifier: %lx ****", self->lastModifier);
}
} else {
// if (string == nil) {
// NSUInteger modifierKey = flags & 0xff;
// if (self->lastModifier != 0 && modifierKey == 0) {
// dlog(DEBUG_SHORTCUT, @"**** Trigger modifier: %lx ****", self->lastModifier);
// NSDictionary *correspondedConfigurations = @{
// @(0x01): @(CIMSharedConfiguration->leftControlKeyShortcutBehavior),
// @(0x20): @(CIMSharedConfiguration->leftOptionKeyShortcutBehavior),
// @(0x08): @(CIMSharedConfiguration->leftCommandKeyShortcutBehavior),
// @(0x10): @(CIMSharedConfiguration->leftCommandKeyShortcutBehavior),
// @(0x40): @(CIMSharedConfiguration->leftOptionKeyShortcutBehavior),
// };
// for (NSNumber *marker in @[@(0x01), @(0x20), @(0x08), @(0x10), @(0x40)]) {
// if (self->lastModifier == marker.unsignedIntegerValue ) {
// NSInteger configuration = [correspondedConfigurations[marker] integerValue];
// switch (configuration) {
// case 0:
// break;
// case 1: {
// dlog(DEBUG_SHORTCUT, @"**** Layout exchange by exchange modifier ****");
// need_exchange = YES;
// } break;
// case 2: {
// dlog(DEBUG_SHORTCUT, @"**** Hanja mode by hanja modifier ****");
// need_hanjamode = YES;
// } break;
// case 3: if (self.delegate == self->hangulComposer) {
// dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to english modifier ****");
// need_exchange = YES;
// } break;
// case 4: if (self.delegate == self->romanComposer) {
// dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to korean modifier ****");
// need_exchange = YES;
// } break;
// default:
// dassert(NO);
// break;
// }
// }
// }
// } else {
// self->lastModifier = modifierKey;
// dlog(DEBUG_SHORTCUT, @"**** Save modifier: %lx ****", self->lastModifier);
// }
// } else
{
dlog(DEBUG_SHORTCUT, @"**** Reset modifier ****");
self->lastModifier = 0;
@@ -13,7 +13,7 @@
#import "CIMConfiguration.h"
#import "HangulComposer.h"
#define DEBUG_PREFERENCE TRUE
#define DEBUG_PREFERENCE FALSE
@interface GureumPreferencesWindowController ()
@@ -165,9 +165,9 @@ - (void)loadFromConfiguration {
self->inputModeKoreanKeyRecorderCell.keyCombo = SRMakeKeyCombo(configuration->inputModeKoreanKeyCode, configuration->inputModeKoreanKeyModifier);
// common
NSLog(@"default input mode: %d", configuration->autosaveDefaultInputMode);
dlog(DEBUG_PREFERENCE, @"default input mode: %d", configuration->autosaveDefaultInputMode);
self->autosaveDefaultInputModeCheckbox.integerValue = configuration->autosaveDefaultInputMode;
NSLog(@"last hangul input mode: %@", configuration->lastHangulInputMode);
dlog(DEBUG_PREFERENCE, @"last hangul input mode: %@", configuration->lastHangulInputMode);
NSInteger index = [GureumPreferencesHangulLayouts indexOfObject:configuration->lastHangulInputMode];
self->defaultHangulInputModeComboBox.stringValue = GureumPreferencesHangulLayoutLocalizedNames[index];
self->romanModeByEscapeKeyCheckbox.integerValue = configuration->romanModeByEscapeKey;
@@ -202,6 +202,8 @@ - (void)saveToConfiguration:(id)sender {
configuration->inputModeHanjaKeyCode = self->inputModeHanjaKeyRecorderCell.keyCombo.code;
configuration->inputModeHanjaKeyModifier = self->inputModeHanjaKeyRecorderCell.keyCombo.flags;
configuration->inputModeEnglishKeyCode = self->inputModeEnglishKeyRecorderCell.keyCombo.code;
configuration->inputModeEnglishKeyModifier = self->inputModeEnglishKeyRecorderCell.keyCombo.flags;
configuration->inputModeKoreanKeyCode = self->inputModeKoreanKeyRecorderCell.keyCombo.code;
configuration->inputModeKoreanKeyModifier = self->inputModeKoreanKeyRecorderCell.keyCombo.flags;
// common

0 comments on commit ad8331a

Please sign in to comment.