add_dirty_callback


Description:

public OnscreenDirtyClosure add_dirty_callback (OnscreenDirtyCallback callback, UserDataDestroyCallback? destroy)

Installs a callback function that will be called whenever the window system has lost the contents of a region of the onscreen buffer and the application should redraw it to repair the buffer.

For example this may happen in a window system without a compositor if a window that was previously covering up the onscreen window has been moved causing a region of the onscreen to be exposed.

The callback will be passed a OnscreenDirtyInfo struct which decribes a rectangle containing the newly dirtied region. Note that this may be called multiple times to describe a non-rectangular region composed of multiple smaller rectangles.

The dirty events are separate from cogl_frame_event_sync events so the application should also listen for this event before rendering the dirty region to ensure that the framebuffer is actually ready for rendering.

Parameters:

this

A Onscreen framebuffer

callback

A callback function to call for dirty events

destroy

An optional callback to destroy user_data when the callback is removed or this is freed.

user_data

A private pointer to be passed to callback

Returns:

a OnscreenDirtyClosure pointer that can be used to remove the callback and associated user_data later.