Skip to content

Commit

Permalink
Remove modifier keys (ctrl, opt, cmd, shift and fn), #8
Browse files Browse the repository at this point in the history
  • Loading branch information
aahung committed Aug 10, 2018
1 parent 33df92a commit afad9a4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
9 changes: 0 additions & 9 deletions Unshaky/PreferenceViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,7 @@ class PreferenceViewController: NSViewController,
117: "ForwardDelete",
52: "Linefeed",
53: "Escape",
54: "RightCommand",
55: "Command",
56: "Shift",
57: "CapsLock",
58: "Option",
59: "Control",
60: "RightShift",
61: "RightOption",
62: "RightControl",
63: "Function",
122: "F1",
120: "F2",
99: "F3",
Expand Down
27 changes: 0 additions & 27 deletions Unshaky/ShakyPressPreventer.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,6 @@ - (CGEventRef)filterShakyPressEvent:(CGEventRef)event {
// ignore unconfigured keys
if (keyDelays[keyCode] == 0) return event;

{
// handle control, command, option and shift keys
CGEventFlags flags;
BOOL isModifierPressed;
switch (keyCode) {
case 54: // RightCommand
case 55: // Command
case 56: // Shift
case 58: // Option
case 59: // Control
case 60: // RightShift
case 61: // RightOption
case 62: // RightControl (this key does not exist on MacBook Pro's keyboard)
case 63: // Function
flags = CGEventGetFlags(event);
isModifierPressed = (flags & (kCGEventFlagMaskAlternate | kCGEventFlagMaskCommand | kCGEventFlagMaskControl | kCGEventFlagMaskShift | kCGEventFlagMaskSecondaryFn)) > 0;
if (isModifierPressed)
eventType = kCGEventKeyDown;
else
eventType = kCGEventKeyUp;
break;

default:
break;
}
}

if (lastPressedTimestamps[keyCode] == 0.0) {
lastPressedTimestamps[keyCode] = [[NSDate date] timeIntervalSince1970];
lastPressedEventTypes[keyCode] = eventType;
Expand Down

0 comments on commit afad9a4

Please sign in to comment.