[gtk+/rendering-cleanup: 70/95] gdk: Don't require allocating window background colors anymore
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup: 70/95] gdk: Don't require allocating window background colors anymore
- Date: Sat, 7 Aug 2010 03:16:46 +0000 (UTC)
commit 83d2a51b2ea74017ea42a8a38fa7add52eb4a5b0
Author: Benjamin Otte <otte redhat com>
Date: Sat Jul 31 11:20:46 2010 +0200
gdk: Don't require allocating window background colors anymore
X!! allocates the colors itself now.
gdk/gdkoffscreenwindow.c | 2 --
gdk/gdkwindow.c | 5 -----
gdk/x11/gdkwindow-x11.c | 11 ++++++++++-
3 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 257abea..c8fc418 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 335eca2..f39d2ca 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 1339b7b..bf919cb 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]