<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGEventSourceSetUserData",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGEventSourceSetUserData"
  },
  "title" : "CGEventSourceSetUserData"
}
-->

# CGEventSourceSetUserData

Sets the 64-bit user-specified data for a Quartz event source.

```
extern void CGEventSourceSetUserData(CGEventSourceRef source, int64_t userData);
```

## Parameters

`source`

The event source to access.

`userData`

The user-specified data. For example, you could specify a vendor hardware ID.

## Discussion

Each input event includes 64 bits of user-specified data. This function sets the user-specified data for all events created by the specified event source. This data may also be set per event using the [`setIntegerValueField(_:value:)`](/documentation/CoreGraphics/CGEvent/setIntegerValueField(_:value:)) function.

---

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)