diff options
author | Benjamin Otte <otte@redhat.com> | 2010-07-31 11:20:46 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-08-10 21:02:30 +0200 |
commit | 13087315808a2bf88a647dcbf75446cd48c563a1 (patch) | |
tree | 28728e92b852f6a9b3f4e25f2647e21c1cc3f41d /gdk | |
parent | c3a59fbfcc078f3991b49b6ca50d9bfaac7a588d (diff) | |
download | gtk+-13087315808a2bf88a647dcbf75446cd48c563a1.tar.gz |
gdk: Don't require allocating window background colors anymore
X!! allocates the colors itself now.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkoffscreenwindow.c | 2 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 5 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 11 |
3 files changed, 10 insertions, 8 deletions
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index 257abea4d4..c8fc4187ae 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -676,10 +676,8 @@ gdk_offscreen_window_set_background (GdkWindow *window, const GdkColor *color) { GdkWindowObject *private = (GdkWindowObject *)window; - GdkColormap *colormap = gdk_drawable_get_colormap (window); private->bg_color = *color; - gdk_colormap_query_color (colormap, private->bg_color.pixel, &private->bg_color); if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG && diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 335eca2ab8..f39d2ca35e 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -7072,9 +7072,6 @@ gdk_window_get_background (GdkWindow *window, * you're an application - or gtk_style_set_background() - if you're * implementing a custom widget.) * - * The @color must be allocated; gdk_rgb_find_color() is the best way - * to allocate a color. - * * See also gdk_window_set_background_pixmap(). */ void @@ -7082,7 +7079,6 @@ gdk_window_set_background (GdkWindow *window, const GdkColor *color) { GdkWindowObject *private; - GdkColormap *colormap = gdk_drawable_get_colormap (window); GdkWindowImplIface *impl_iface; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -7090,7 +7086,6 @@ gdk_window_set_background (GdkWindow *window, private = (GdkWindowObject *) window; private->bg_color = *color; - gdk_colormap_query_color (colormap, private->bg_color.pixel, &private->bg_color); if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG && diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 1339b7bbb4..bf919cbd15 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -2637,8 +2637,17 @@ static void gdk_window_x11_set_background (GdkWindow *window, const GdkColor *color) { + GdkColor allocated = *color; + + if (!gdk_colormap_alloc_color (gdk_drawable_get_colormap (window), + &allocated, + TRUE, TRUE)) + return; + XSetWindowBackground (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), color->pixel); + GDK_WINDOW_XID (window), allocated.pixel); + + gdk_colormap_free_colors (gdk_drawable_get_colormap (window), &allocated, 1); } static void |