From 6cd2bc0d6770d07974d92c3393bcbc452314aa7a Mon Sep 17 00:00:00 2001 From: Mengjuei Hsieh Date: Sat, 1 Oct 2011 02:25:40 -0700 Subject: [PATCH] capslock processing --- Source/InputMethodController.mm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index fddd3871..afa38078 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -436,6 +436,15 @@ public: bool composeReading = false; + // caps lock processing : if caps locked, temporarily disabled bopomofo. + if ([NSEvent modifierFlags] & NSAlphaShiftKeyMask){ + if ([_composingBuffer length]) [self commitComposition:client]; + if ([NSEvent modifierFlags] & NSShiftKeyMask) return NO; + NSString *popedText = [inputText lowercaseString]; + [client insertText:popedText replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; + return YES; + } + // see if it's valid BPMF reading if (_bpmfReadingBuffer->isValidKey((char)charCode)) { _bpmfReadingBuffer->combineKey((char)charCode); @@ -667,12 +676,12 @@ public: // still nothing, then we update the composing buffer (some app has // strange behavior if we don't do this, "thinking" the key is not // actually consumed) - if ([_composingBuffer length]) { + if ([_composingBuffer length]) { [self beep]; [self updateClientComposingBuffer:client]; return YES; } - + return NO; }