Cogl.Onscreen.prototype.add_dirty_callback

function add_dirty_callback(callback: Cogl.OnscreenDirtyCallback, destroy: Cogl.UserDataDestroyCallback): Cogl.OnscreenDirtyClosure {
    // Gjs wrapper for cogl_onscreen_add_dirty_callback()
}
  

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 Cogl.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.FrameEvent.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.

Since 1.16

callback

A callback function to call for dirty events

destroy

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

Returns

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