示例#1
0
static void
apply_background_to_window (GSManager *manager,
                            GSWindow  *window)
{
	cairo_surface_t *surface;
	int              width;
	int              height;

        mate_bg_load_from_preferences (manager->priv->bg);

	if (manager->priv->bg == NULL)
	{
		gs_debug ("No background available");
		gs_window_set_background_surface (window, NULL);
	}

	gtk_widget_get_preferred_width (GTK_WIDGET (window), &width, NULL);
	gtk_widget_get_preferred_height (GTK_WIDGET (window), &height, NULL);
	gs_debug ("Creating background w:%d h:%d", width, height);
	surface = mate_bg_create_surface (manager->priv->bg,
	                                  gs_window_get_gdk_window (window),
	                                  width,
	                                  height,
	                                  FALSE);
	gs_window_set_background_surface (window, surface);
	cairo_surface_destroy (surface);
}
示例#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
static void
apply_background_to_window (GSManager *manager,
                            GSWindow  *window)
{
#if GTK_CHECK_VERSION (3, 0, 0)
	cairo_surface_t *surface;
#else
	GdkPixmap       *pixmap;
#endif
	GdkScreen       *screen;
	int              width;
	int              height;

	if (manager->priv->bg == NULL)
	{
		gs_debug ("No background available");
#if GTK_CHECK_VERSION (3, 0, 0)
		gs_window_set_background_surface (window, NULL);
#else
		gs_window_set_background_pixmap (window, NULL);
#endif
	}

	screen = gs_window_get_screen (window);
	width = gdk_screen_get_width (screen);
	height = gdk_screen_get_height (screen);
	gs_debug ("Creating background w:%d h:%d", width, height);
#if GTK_CHECK_VERSION (3, 0, 0)
	surface = mate_bg_create_surface (manager->priv->bg,
	                                  gs_window_get_gdk_window (window),
	                                  width,
	                                  height,
	                                  FALSE);
	gs_window_set_background_surface (window, surface);
	cairo_surface_destroy (surface);
#else
	pixmap = mate_bg_create_pixmap (manager->priv->bg,
	                                gs_window_get_gdk_window (window),
	                                width,
	                                height,
	                                FALSE);
	gs_window_set_background_pixmap (window, pixmap);
	g_object_unref (pixmap);
#endif
}
示例#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;
}