gnome-bg

## gnome-bg gnome-bg |

## Functions

GnomeBG * | gnome_bg_new ()
void | gnome_bg_load_from_preferences ()
void | gnome_bg_save_to_preferences ()
void | gnome_bg_set_filename ()
void | gnome_bg_set_placement ()
void | gnome_bg_set_color ()
GDesktopBackgroundStyle | gnome_bg_get_placement ()
void | gnome_bg_get_color ()
const gchar * | gnome_bg_get_filename ()
void | gnome_bg_draw ()
cairo_surface_t * | gnome_bg_create_surface ()
gboolean | gnome_bg_get_image_size ()
GdkPixbuf * | gnome_bg_create_thumbnail ()
gboolean | gnome_bg_is_dark ()
gboolean | gnome_bg_has_multiple_sizes ()
gboolean | gnome_bg_changes_with_time ()
GdkPixbuf * | gnome_bg_create_frame_thumbnail ()
void | gnome_bg_set_surface_as_root ()
GnomeBGCrossfade * | gnome_bg_set_surface_as_root_with_crossfade ()
cairo_surface_t * | gnome_bg_get_surface_from_root ()

## Signals

void | changed | Run Last
void | transitioned | Run Last

## Types and Values

| GnomeBG
| GnomeBGClass

## Object Hierarchy

        GObject
        ╰── GnomeBG

## Description

## Functions

### gnome_bg_new ()

    GnomeBG *
    gnome_bg_new (void);

### gnome_bg_load_from_preferences ()

    void
    gnome_bg_load_from_preferences (GnomeBG *bg,
                                    GSettings *settings);

### gnome_bg_save_to_preferences ()

    void
    gnome_bg_save_to_preferences (GnomeBG *bg,
                                  GSettings *settings);

### gnome_bg_set_filename ()

    void
    gnome_bg_set_filename (GnomeBG *bg,
                           const char *filename);

### gnome_bg_set_placement ()

    void
    gnome_bg_set_placement (GnomeBG *bg,
                            GDesktopBackgroundStyle placement);

### gnome_bg_set_color ()

    void
    gnome_bg_set_color (GnomeBG *bg,
                        GDesktopBackgroundShading type,
                        GdkColor *primary,
                        GdkColor *secondary);

### gnome_bg_get_placement ()

    GDesktopBackgroundStyle
    gnome_bg_get_placement (GnomeBG *bg);

### gnome_bg_get_color ()

    void
    gnome_bg_get_color (GnomeBG *bg,
                        GDesktopBackgroundShading *type,
                        GdkColor *primary,
                        GdkColor *secondary);

### gnome_bg_get_filename ()

    const gchar *
    gnome_bg_get_filename (GnomeBG *bg);

### gnome_bg_draw ()

    void
    gnome_bg_draw (GnomeBG *bg,
                   GdkPixbuf *dest,
                   GdkScreen *screen,
                   gboolean is_root);

### gnome_bg_create_surface ()

    cairo_surface_t *
    gnome_bg_create_surface (GnomeBG *bg,
                             GdkWindow *window,
                             int width,
                             int height,
                             gboolean root);

Create a surface that can be set as background for `window` . If `is_root` is TRUE, the surface created will be created by a temporary X server connection so that if someone calls XKillClient on it, it won't affect the application who created it.

#### Parameters

bg | GnomeBG |

#### Returns

`NULL` on error (e.g. out of X connections)

### gnome_bg_get_image_size ()

    gboolean
    gnome_bg_get_image_size (GnomeBG *bg,
                             GnomeDesktopThumbnailFactory *factory,
                             int best_width,
                             int best_height,
                             int *width,
                             int *height);

### gnome_bg_create_thumbnail ()

    GdkPixbuf *
    gnome_bg_create_thumbnail (GnomeBG *bg,
                               GnomeDesktopThumbnailFactory *factory,
                               GdkScreen *screen,
                               int dest_width,
                               int dest_height);

#### Returns

a GdkPixbuf showing the background as a thumbnail.

[transfer full]

### gnome_bg_is_dark ()

    gboolean
    gnome_bg_is_dark (GnomeBG *bg,
                      int dest_width,
                      int dest_height);

### gnome_bg_has_multiple_sizes ()

    gboolean
    gnome_bg_has_multiple_sizes (GnomeBG *bg);

### gnome_bg_changes_with_time ()

    gboolean
    gnome_bg_changes_with_time (GnomeBG *bg);

### gnome_bg_create_frame_thumbnail ()

    GdkPixbuf *
    gnome_bg_create_frame_thumbnail (GnomeBG *bg,
                                     GnomeDesktopThumbnailFactory *factory,
                                     GdkScreen *screen,
                                     int dest_width,
                                     int dest_height,
                                     int frame_num);

Creates a thumbnail for a certain frame, where 'frame' is somewhat vaguely defined as 'suitable point to show while single-stepping through the slideshow'.

#### Returns

the newly created thumbnail or or NULL if frame_num is out of bounds.

[transfer full]

### gnome_bg_set_surface_as_root ()

    void
    gnome_bg_set_surface_as_root (GdkScreen *screen,
                                  cairo_surface_t *surface);

Set the root pixmap, and properties pointing to it. We do this atomically with a server grab to make sure that we won't leak the pixmap if somebody else it setting it at the same time. (This assumes that they follow the same conventions we do). `surface` should come from a call to `gnome_bg_create_surface()`.

#### Parameters

screen | the GdkScreen to change root background on |
surface | the cairo_surface_t to set root background from. Must be an xlib surface backing a pixmap. |

### gnome_bg_set_surface_as_root_with_crossfade ()

    GnomeBGCrossfade *
    gnome_bg_set_surface_as_root_with_crossfade
                                   (GdkScreen *screen,
                                    cairo_surface_t *surface);

Set the root pixmap, and properties pointing to it. This function differs from `gnome_bg_set_surface_as_root()` in that it adds a subtle crossfade animation from the current root pixmap to the new one.

#### Parameters

screen | the GdkScreen to change root background on |
surface | the cairo xlib surface to set root background from |

#### Returns

a GnomeBGCrossfade object.

[transfer full]

### gnome_bg_get_surface_from_root ()

    cairo_surface_t *
    gnome_bg_get_surface_from_root (GdkScreen *screen);

This function queries the _XROOTPMAP_ID property from the root window associated with `screen` to determine the current root window background pixmap and returns a copy of it. If the _XROOTPMAP_ID is not set, then a black surface is returned.

#### Parameters

screen | a GdkScreen |

#### Returns

a cairo_surface_t if successful or `NULL`

## Types and Values

### GnomeBG

    typedef struct _GnomeBG GnomeBG;

### GnomeBGClass

    typedef struct _GnomeBGClass GnomeBGClass;

## Signal Details

### The `“changed”` signal

    void
    user_function (GnomeBG *bg,
                   gpointer user_data)

Flags: Run Last

### The `“transitioned”` signal

    void
    user_function (GnomeBG *bg,
                   gpointer user_data)

Flags: Run Last