Permalink
Browse files

Fix detecting state of caps lock

GureumComposer checks `flags.rawValue == 0` to determine whether caps
lock is off. But if `event.modifierFlags` is ignored, then
GureumComposer will think caps lock is off when other modifier keys are
pressed.
  • Loading branch information...
yous committed Oct 9, 2018
1 parent 513ab6a commit 011253dc0fdeff76bf82a76a5a59c9d947357614
Showing with 4 additions and 4 deletions.
  1. +4 −4 CommonInputMethod/CIMInputController.m
@@ -329,16 +329,16 @@ @implementation CIMInputController (IMKServerInputHandleEvent)
// Receiving Events Directly from the Text Services Manager
- (BOOL)handleEvent:(NSEvent *)event client:(id)sender {
if (event.type == NSKeyDown) {
if (event.type == NSEventTypeKeyDown) {
dlog(DEBUG_INPUTCONTROLLER, @"** CIMInputController KEYDOWN -handleEvent:client: with event: %@ / key: %d / modifier: %lu / chars: %@ / chars ignoreMod: %@ / client: %@", event, [event keyCode], [event modifierFlags], [event characters], [event charactersIgnoringModifiers], [[self client] bundleIdentifier]);
BOOL processed = [self->_receiver inputController:self inputText:event.characters key:event.keyCode modifiers:event.modifierFlags client:sender] > CIMInputTextProcessResultNotProcessed;
dlog(DEBUG_LOGGING, @"LOGGING::PROCESSED::%d", processed);
return processed;
}
else if (event.type == NSFlagsChanged) {
NSEventModifierFlags modifierFlags = 0;
else if (event.type == NSEventTypeFlagsChanged) {
NSEventModifierFlags modifierFlags = event.modifierFlags;
if (self->_ioConnect.capsLockState) {
modifierFlags |= NSAlphaShiftKeyMask;
modifierFlags |= NSEventModifierFlagCapsLock;
}
dlog(DEBUG_LOGGING, @"modifierFlags by IOKit: %lx", modifierFlags);
//dlog(DEBUG_INPUTCONTROLLER, @"** CIMInputController FLAGCHANGED -handleEvent:client: with event: %@ / key: %d / modifier: %lu / chars: %@ / chars ignoreMod: %@ / client: %@", event, -1, modifierFlags, nil, nil, [[self client] bundleIdentifier]);

0 comments on commit 011253d

Please sign in to comment.