Function

CGRegisterScreenRefreshCallback(_:_:)

Registers a callback function to be invoked when local displays are refreshed or modified.

Declaration

func CGRegisterScreenRefreshCallback(_ callback: CGScreenRefreshCallback, _ userInfo: UnsafeMutableRawPointer?) -> CGError

Parameters

function

A pointer to the callback function to be registered.

userParameter

A pointer to user-defined data, or NULL. The userParameter argument is passed back to the callback function each time it’s invoked.

Return Value

A result code. See Core Graphics Data Types and Constants.

Discussion

A callback function may be registered multiple times with different user-defined data pointers, resulting in multiple registration entries. For each registration, when notification is no longer needed, you should call the function CGUnregisterScreenRefreshCallback(_:_:) to remove the registration.

The callback function you register is invoked only if your application has an active event loop. The callback is invoked in the same thread of execution that is processing events within your application.

Special Considerations

In OS X v10.4 and earlier, the result code returned by this function is a random value and should be ignored. In macOS 10.5 and later, the result code is valid.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software