### Function

# Clutter threads_add_repaint_func

#### Declaration [src]

    guint
    clutter_threads_add_repaint_func (
      ClutterRepaintFlags flags,
      GSourceFunc func,
      gpointer data,
      GDestroyNotify notify
    )

#### Description [src]

Adds a function to be called whenever Clutter is processing a new frame.

If the function returns `FALSE` it is automatically removed from the list of repaint functions and will not be called again.

This function is guaranteed to be called from within the same thread that called clutter_main(), and while the Clutter lock is being held; the function will be called within the main loop, so it is imperative that it does not block, otherwise the frame time budget may be lost.

A repaint function is useful to ensure that an update of the scenegraph is performed before the scenegraph is repainted. The `flags` passed to this function will determine the section of the frame processing that will result in `func` being called.

Adding a repaint function does not automatically ensure that a new frame will be queued.

When the repaint function is removed (either because it returned `FALSE` or because `clutter_threads_remove_repaint_func()` has been called) the `notify` function will be called, if any is set.

#### Parameters

`flags`

  Type: `ClutterRepaintFlags`

  Flags for the repaint function.

`func`

  Type: `GSourceFunc`

  The function to be called within the paint cycle.

`data`

  Type: `gpointer`

  Data to be passed to the function, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`notify`

  Type: `GDestroyNotify`

  Function to be called when removing the repaint function, or `NULL`.

#### Return value

Type: `guint`

The ID (greater than 0) of the repaint function. You can use the returned integer to remove the repaint function by calling clutter_threads_remove_repaint_func().