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

# CGDisplayReconfigurationCallBack

A client-supplied callback function that’s invoked whenever the configuration of a local display is changed.

```
typealias CGDisplayReconfigurationCallBack = (CGDirectDisplayID, CGDisplayChangeSummaryFlags, UnsafeMutableRawPointer?) -> Void
```

## Parameters

`display`

The display being reconfigured.

`flags`

Flags that indicate which display configuration parameters are changing.

`userInfo`

The `userInfo` argument passed to the function [`CGDisplayRegisterReconfigurationCallback(_:_:)`](/documentation/CoreGraphics/CGDisplayRegisterReconfigurationCallback(_:_:)) when the callback function is registered.

## Discussion

If you named your function `MyDisplayReconfigurationCallBack`, you would declare it like this:

### Discussion

To register a display reconfiguration callback function, you call the function [`CGDisplayRegisterReconfigurationCallback(_:_:)`](/documentation/CoreGraphics/CGDisplayRegisterReconfigurationCallback(_:_:)). Quartz invokes your callback function when:

- Your application calls a function to reconfigure a local display.
- Your application is listening for events in the event-processing thread, and another application calls a function to reconfigure a local display.
- The user changes the display hardware configuration—for example, by disconnecting a display or changing a system preferences setting.

Before display reconfiguration, Quartz invokes your callback function once for each online display to indicate a pending configuration change.  The `flags` argument is always set to `kCGDisplayBeginConfigurationFlag`. The only display-specific information contained by this callback is the display ID number.The reason is that details of how a reconfiguration affects a particular device rely on device-specific behaviors which may not be available to a device driver.

After display reconfiguration, Quartz  invokes your callback function once for each added, removed, and online display. At this time, all display state reported by Core Graphics and QuickDraw will be up to date. The `flags` argument indicates how the display configuration has changed. Note that in the case of removed displays, calls into Quartz with the removed display ID will fail.

The following code example illustrates how to test for specific conditions:

```objc
void MyDisplayReconfigurationCallBack (
   CGDirectDisplayID display,
   CGDisplayChangeSummaryFlags flags,
   void *userInfo)
{
    if (flags & kCGDisplayAddFlag) {
        // display has been added
    }
    else if (flags & kCGDisplayRemoveFlag) {
        // display has been removed
    }
}
```

Your callback function should avoid attempting to change display configurations and should not raise exceptions or perform a nonlocal return such as calling `longjmp`. When you are finished using a callback registration, you should call the function [`CGDisplayRemoveReconfigurationCallback(_:_:)`](/documentation/CoreGraphics/CGDisplayRemoveReconfigurationCallback(_:_:)) to remove it.

---

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)