diff options
author | jacob berkman <jacob@ximian.com> | 2002-05-21 22:13:38 +0000 |
---|---|---|
committer | Jacob Berkman <jberkman@src.gnome.org> | 2002-05-21 22:13:38 +0000 |
commit | 50b3bfe107f4a444f5ae82ee3cb2d5c997bd68e3 (patch) | |
tree | f8923463025ed17d55aabfeec98600c3d4de9914 /libbackground | |
parent | 5a1f9db561f8fd5a84150cf422c3ca8ecfd8635d (diff) | |
download | gnome-control-center-50b3bfe107f4a444f5ae82ee3cb2d5c997bd68e3.tar.gz |
use a gc for the pixmap not the root windowNAUTILUS_1_1_18
2002-05-21 jacob berkman <jacob@ximian.com>
* applier.c (render_to_screen): use a gc for the pixmap not the
root window
(bg_applier_get_preview_widget): don't create the pixmap until we
are realized
(make_root_pixmap): use gdk_get_display(), not getenv ("DISPLAY"),
and set the colormap for our GdkPixmap so we can draw on it
(preview_realized_cb): create the pixmap here, and set it on our
GtkImage
fixes #73496
Diffstat (limited to 'libbackground')
-rw-r--r-- | libbackground/ChangeLog | 13 | ||||
-rw-r--r-- | libbackground/applier.c | 28 |
2 files changed, 30 insertions, 11 deletions
diff --git a/libbackground/ChangeLog b/libbackground/ChangeLog index 250ed78b4..9c1e03afb 100644 --- a/libbackground/ChangeLog +++ b/libbackground/ChangeLog @@ -1,3 +1,16 @@ +2002-05-21 jacob berkman <jacob@ximian.com> + + * applier.c (render_to_screen): use a gc for the pixmap not the + root window + (bg_applier_get_preview_widget): don't create the pixmap until we + are realized + (make_root_pixmap): use gdk_get_display(), not getenv ("DISPLAY"), + and set the colormap for our GdkPixmap so we can draw on it + (preview_realized_cb): create the pixmap here, and set it on our + GtkImage + + fixes #73496 + 2002-05-16 jacob berkman <jacob@ximian.com> * applier.c (bg_applier_apply_prefs): don't spew a warning when diff --git a/libbackground/applier.c b/libbackground/applier.c index 4bdad4ed0..13f92b0de 100644 --- a/libbackground/applier.c +++ b/libbackground/applier.c @@ -491,13 +491,7 @@ bg_applier_get_preview_widget (BGApplier *bg_applier) { if (bg_applier->p->preview_widget == NULL) { - GdkPixmap *pixmap; - - pixmap = gdk_pixmap_new (gdk_get_default_root_window (), - bg_applier->p->render_geom.width, - bg_applier->p->render_geom.height, - -1); - bg_applier->p->preview_widget = gtk_image_new_from_pixmap (pixmap, NULL); + bg_applier->p->preview_widget = gtk_image_new (); /* We need to initialize the pixmap, but this * needs GCs, so we have to wait until realize. */ @@ -771,7 +765,7 @@ render_to_screen (BGApplier *bg_applier, const BGPreferences *prefs) g_return_if_fail (prefs != NULL); g_return_if_fail (IS_BG_PREFERENCES (prefs)); - gc = gdk_gc_new (gdk_get_default_root_window ()); + gc = gdk_gc_new (bg_applier->p->pixmap); if (bg_applier->p->pixbuf != NULL) { if (bg_applier->p->pixbuf_render_geom.x != 0 || @@ -1354,8 +1348,9 @@ make_root_pixmap (gint width, gint height) { Display *display; Pixmap xpixmap; + GdkPixmap *gdkpixmap; - display = XOpenDisplay (g_getenv ("DISPLAY")); + display = XOpenDisplay (gdk_get_display ()); XSetCloseDownMode (display, RetainPermanent); xpixmap = XCreatePixmap (display, @@ -1365,7 +1360,11 @@ make_root_pixmap (gint width, gint height) XCloseDisplay (display); - return gdk_pixmap_foreign_new (xpixmap); + gdkpixmap = gdk_pixmap_foreign_new (xpixmap); + gdk_drawable_set_colormap (GDK_DRAWABLE (gdkpixmap), + gdk_drawable_get_colormap (gdk_get_default_root_window ())); + + return gdkpixmap; } /* Set the root pixmap, and properties pointing to it. We @@ -1527,9 +1526,16 @@ preview_realized_cb (GtkWidget *preview, BGApplier *bg_applier) /* Only draw clean image if no pref set yet */ if (bg_applier->p->last_prefs) - return; + return; gtk_image_get_pixmap (GTK_IMAGE (preview), &pixmap, NULL); + if (!pixmap) { + pixmap = gdk_pixmap_new (preview->window, + bg_applier->p->render_geom.width, + bg_applier->p->render_geom.height, + -1); + gtk_image_set_from_pixmap (GTK_IMAGE (preview), pixmap, NULL); + } gdk_draw_rectangle (pixmap, preview->style->bg_gc[preview->state], |