static void apply_background_to_window (GSManager *manager, GSWindow *window) { cairo_surface_t *surface; GdkScreen *screen; GdkWindow *gdk_window; gint monitor; GdkRectangle monitor_geometry; int width; int height; if (manager->priv->bg == NULL) { gs_debug ("No background available"); gs_window_set_background_surface (window, NULL); } screen = gs_window_get_screen (window); gdk_window = gs_window_get_gdk_window (window); monitor = gdk_screen_get_monitor_at_window (screen, gdk_window); gdk_screen_get_monitor_geometry (screen, monitor, &monitor_geometry); width = monitor_geometry.width; height = monitor_geometry.height; gs_debug ("Creating background w:%d h:%d", width, height); surface = gnome_bg_create_surface (manager->priv->bg, gdk_window, width, height, FALSE); gs_window_set_background_surface (window, surface); cairo_surface_destroy (surface); }
static gboolean athena_desktop_background_ensure_realized (AthenaDesktopBackground *self) { int entire_width; int entire_height; GdkScreen *screen; GdkWindow *window; screen = gtk_widget_get_screen (self->details->widget); entire_height = gdk_screen_get_height (screen); entire_width = gdk_screen_get_width (screen); /* If the window size is the same as last time, don't update */ if (entire_width == self->details->background_entire_width && entire_height == self->details->background_entire_height) { return FALSE; } free_background_surface (self); window = gtk_widget_get_window (self->details->widget); self->details->background_surface = gnome_bg_create_surface (self->details->bg, window, entire_width, entire_height, TRUE); /* 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), "ignore-pending-change", GINT_TO_POINTER (TRUE)); self->details->background_entire_width = entire_width; self->details->background_entire_height = entire_height; return TRUE; }