Cogl.Onscreen.prototype.add_swap_buffers_callback

function add_swap_buffers_callback(callback: Cogl.SwapBuffersNotify): Number(guint) {
    // Gjs wrapper for cogl_onscreen_add_swap_buffers_callback()
}
  

Installs a callback function that should be called whenever a swap buffers request (made using Cogl.Onscreen.prototype.swap_buffers) for the given onscreen completes.

<note>Applications should check for the Cogl.FeatureID.ogl_feature_id_swap_buffers_event feature before using this API. It's currently undefined when and if registered callbacks will be called if this feature is not supported.</note>

We recommend using this mechanism when available to manually throttle your applications (in conjunction with Cogl.Onscreen.prototype.set_swap_throttled) so your application will be able to avoid long blocks in the driver caused by throttling when you request to swap buffers too quickly.

Since 1.10

callback

A callback function to call when a swap has completed

Returns

a unique identifier that can be used to remove to remove the callback later.