Merge pull request #50 from dperson/master

Fix Issue #49 - Blanking the terminal
This commit is contained in:
Gennadiy Potapov 2014-03-15 12:52:29 +08:00
commit 0b79c1fafd

View file

@ -299,10 +299,11 @@
NSLog(@"No event source");
return;
}
//9 = "v"
CGEventRef eventDown = CGEventCreateKeyboardEvent(sourceRef, (CGKeyCode)9, true);
NSNumber *keyCode = [srTransformer reverseTransformedValue:@"V"];
CGKeyCode veeCode = (CGKeyCode)[keyCode intValue];
CGEventRef eventDown = CGEventCreateKeyboardEvent(sourceRef, veeCode, true);
CGEventSetFlags(eventDown, kCGEventFlagMaskCommand|0x000008); // some apps want bit set for one of the command keys
CGEventRef eventUp = CGEventCreateKeyboardEvent(sourceRef, (CGKeyCode)9, false);
CGEventRef eventUp = CGEventCreateKeyboardEvent(sourceRef, veeCode, false);
CGEventPost(kCGHIDEventTap, eventDown);
CGEventPost(kCGHIDEventTap, eventUp);
CFRelease(eventDown);