gdk: Don't require allocating window background colors anymore

X!! allocates the colors itself now.
This commit is contained in:
Benjamin Otte 2010-07-31 11:20:46 +02:00
parent c3a59fbfcc
commit 1308731580
3 changed files with 10 additions and 8 deletions

View File

@ -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 &&

View File

@ -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 &&

View File

@ -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