From 6983cf7503268a7621250fe4f47dc1e42921ede5 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sat, 10 Nov 2007 23:15:03 +0000 Subject: [PATCH] Cleanup ecore_x_window_background_color_set(). SVN revision: 32553 --- legacy/ecore/src/lib/ecore_x/ecore_x_window.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_window.c b/legacy/ecore/src/lib/ecore_x/ecore_x_window.c index 626ba840cb..1855435059 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_window.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_window.c @@ -1123,24 +1123,26 @@ ecore_x_window_parent_get(Ecore_X_Window win) /** * Sets the background color of the given window. * @param win The given window - * @param color The color to set to (i.e. 0xff0000) + * @param r red value (0...65536, 16 bits) + * @param g green value (0...65536, 16 bits) + * @param b blue value (0...65536, 16 bits) */ EAPI void ecore_x_window_background_color_set(Ecore_X_Window win, unsigned short r, unsigned short g, unsigned short b) { XSetWindowAttributes attr; + Colormap map; XColor col; col.red = r; col.green = g; col.blue = b; - - XAllocColor(_ecore_x_disp, DefaultColormap(_ecore_x_disp, - DefaultScreen(_ecore_x_disp)), - &col); - - attr.background_pixel = col.pixel; + + map = DefaultColormap(_ecore_x_disp, DefaultScreen(_ecore_x_disp)); + XAllocColor(_ecore_x_disp, map, &col); + + attr.background_pixel = col.pixel; XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr); }