Skip to content

Instantly share code, notes, and snippets.

@ArthurYidi
Created April 7, 2016 18:15
Show Gist options
  • Save ArthurYidi/d21d999f8fed32a8907c94c9c5f41949 to your computer and use it in GitHub Desktop.
Save ArthurYidi/d21d999f8fed32a8907c94c9c5f41949 to your computer and use it in GitHub Desktop.
debug cgevents
switch type {
case .Null:
// system defined events
guard let nsEvent = NSEvent(CGEvent: event) else
{ print("failed nsvent"); break }
print("Null event \(binary(type.rawValue))");
print(nsEvent)
break
case .KeyDown: print("KeyDown event \(binary(type.rawValue))"); break
case .KeyUp: print("KeyUp event \(binary(type.rawValue))"); break
case .FlagsChanged: print("FlagsChanged event \(binary(type.rawValue))"); break
case .LeftMouseDown: print("LeftMouseDown event \(binary(type.rawValue))"); break
case .LeftMouseUp: print("LeftMouseUp event \(binary(type.rawValue))"); break
case .RightMouseDown: print("RightMouseDown event \(binary(type.rawValue))"); break
case .RightMouseUp: print("RightMouseUp event \(binary(type.rawValue))"); break
case .MouseMoved: print("MouseMoved event \(binary(type.rawValue))"); break
case .LeftMouseDragged: print("LeftMouseDragged event \(binary(type.rawValue))"); break
case .RightMouseDragged: print("RightMouseDragged event \(binary(type.rawValue))"); break
case .ScrollWheel: print("ScrollWheel event \(binary(type.rawValue))"); break
case .TabletPointer: print("TabletPointer event \(binary(type.rawValue))"); break
case .TabletProximity: print("TabletProximity event \(binary(type.rawValue))"); break
case .OtherMouseDown: print("OtherMouseDown event \(binary(type.rawValue))"); break
case .OtherMouseUp: print("OtherMouseUp event \(binary(type.rawValue))"); break
case .OtherMouseDragged: print("OtherMouseDragged event \(binary(type.rawValue))"); break
case .TapDisabledByTimeout: print("TapDisabledByTimeout event \(binary(type.rawValue))"); break
case .TapDisabledByUserInput: print("TapDisabledByUserInput event \(binary(type.rawValue))"); break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment