Пример #1
0
/* @color: color or gradient to set */
void
eel_background_set_color (EelBackground *self,
                          const gchar   *color)
{
    if (g_strcmp0 (self->details->color, color) != 0)
    {
        g_free (self->details->color);
        self->details->color = g_strdup (color);

        set_image_properties (self);
    }
}
Пример #2
0
static gboolean
eel_background_ensure_realized (EelBackground *self)
{
    GtkStyle *style;
    int width, height;
    GdkWindow *window;

    /* Set the default color */
    style = gtk_widget_get_style (self->details->widget);
    if (self->details->use_base) {
       self->details->default_color = style->base[GTK_STATE_NORMAL];
    } else {
        self->details->default_color = style->bg[GTK_STATE_NORMAL];
    }

    /* If the window size is the same as last time, don't update */
    drawable_get_adjusted_size (self, &width, &height);
    if (width == self->details->bg_entire_width &&
        height == self->details->bg_entire_height)
    {
        return FALSE;
    }

    free_background_surface (self);

    /* Calls mate_bg_set_color, which sets "ignore-pending-change" to false,
       and queues emission of changed signal if it's still false */
    set_image_properties (self);

    window = gtk_widget_get_window (self->details->widget);
    self->details->bg_surface = mate_bg_create_surface (self->details->bg,
        						window, width, height,
        						self->details->is_desktop);
    self->details->unset_root_surface = self->details->is_desktop;

    /* We got the surface and everything, so we don't care about a change
       that is pending (unless things actually change after this time) */
    g_object_set_data (G_OBJECT (self->details->bg),
                       "ignore-pending-change",
                       GINT_TO_POINTER (TRUE));

    self->details->bg_entire_width = width;
    self->details->bg_entire_height = height;

    return TRUE;
}
Пример #3
0
pixman_image_t *
image_from_pict_18 (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
{
    pixman_image_t *image = NULL;

    if (!pict)
        return NULL;

    if (pict->pDrawable)
    {
        image = create_bits_picture (pict, has_clip, xoff, yoff);
    }
    else if (pict->pSourcePict)
    {
        SourcePict *sp = pict->pSourcePict;

        if (sp->type == SourcePictTypeSolidFill)
        {
            image = create_solid_fill_image (pict);
        }
        else
        {
            PictGradient *gradient = &pict->pSourcePict->gradient;

            if (sp->type == SourcePictTypeLinear)
                image = create_linear_gradient_image (gradient);
            else if (sp->type == SourcePictTypeRadial)
                image = create_radial_gradient_image (gradient);
            else if (sp->type == SourcePictTypeConical)
                image = create_conical_gradient_image (gradient);
        }
        *xoff = *yoff = 0;
    }

    if (image)
        set_image_properties (image, pict, has_clip, xoff, yoff);

    return image;
}
Пример #4
0
static gboolean
eel_background_ensure_realized (EelBackground *self)
{
    GtkStyle *style;
    int width, height;
    GdkWindow *window;

    /* Set the default color */
    style = gtk_widget_get_style (self->details->widget);
    if (self->details->use_base) {
       self->details->default_color = style->base[GTK_STATE_NORMAL];
    } else {
        self->details->default_color = style->bg[GTK_STATE_NORMAL];
    }

    /* If the window size is the same as last time, don't update */
    drawable_get_adjusted_size (self, &width, &height);
    if (width == self->details->bg_entire_width &&
        height == self->details->bg_entire_height)
    {
        return FALSE;
    }

    free_background_surface (self);

    set_image_properties (self);

    window = gtk_widget_get_window (self->details->widget);
    self->details->bg_surface = mate_bg_create_surface (self->details->bg,
        						window, width, height,
        						self->details->is_desktop);
    self->details->unset_root_surface = self->details->is_desktop;

    self->details->bg_entire_width = width;
    self->details->bg_entire_height = height;

    return TRUE;
}