<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGEventMask",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@T@CGEventMask"
  },
  "title" : "CGEventMask"
}
-->

# CGEventMask

Defines a mask that identifies the set of Quartz events to be observed in an event tap.

```
typealias CGEventMask = UInt64
```

## Discussion

When you call either [`tapCreate(tap:place:options:eventsOfInterest:callback:userInfo:)`](/documentation/CoreGraphics/CGEvent/tapCreate(tap:place:options:eventsOfInterest:callback:userInfo:)) or [`tapCreateForPSN(processSerialNumber:place:options:eventsOfInterest:callback:userInfo:)`](/documentation/CoreGraphics/CGEvent/tapCreateForPSN(processSerialNumber:place:options:eventsOfInterest:callback:userInfo:)) to register an event tap, you supply a bit mask that identifies the set of events to be observed. You specify each event using one of the event type constants listed in [`CGEventType`](/documentation/CoreGraphics/CGEventType). To form the bit mask, use the `CGEventMaskBit` macro to convert each constant into an event mask and then OR the individual masks together. For example:

```objc
CGEventMask mask = CGEventMaskBit(kCGEventLeftMouseDown) |
                   CGEventMaskBit(kCGEventLeftMouseUp);
```

You can also supply a mask to observe all events:

```objc
CGEventMask mask = kCGEventMaskForAllEvents;
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)