changeset 373:d04b0699fc28

Fixes for background color drawing on GTK 2.x.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 27 Apr 2003 19:53:29 +0000
parents 3ef2cf70ee07
children 47dc310e6d74
files gtk/dw.c
diffstat 1 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Sun Apr 27 19:21:24 2003 +0000
+++ b/gtk/dw.c	Sun Apr 27 19:53:29 2003 +0000
@@ -55,6 +55,7 @@
 DWTID _dw_thread_list[DW_THREAD_LIMIT];
 GdkColor _foreground[DW_THREAD_LIMIT];
 GdkColor _background[DW_THREAD_LIMIT];
+int _transparent[DW_THREAD_LIMIT];
 
 GtkWidget *last_window = NULL, *popup = NULL;
 
@@ -848,6 +849,7 @@
 			_foreground[z].pixel = _foreground[z].red =_foreground[z].green = _foreground[z].blue = 0;
 			_background[z].pixel = 1;
 			_background[z].red = _background[z].green = _background[z].blue = 0;
+			_transparent[z] = 1;
 			return;
 		}
 	}
@@ -5206,11 +5208,6 @@
 /* Returns a GdkColor from a DW color */
 static GdkColor _internal_color(unsigned long value)
 {
-	if(value == DW_CLR_DEFAULT)
-	{
-		GdkColor color = { 1, 0, 0, 0 };
-		return color;
-	}
 	if(DW_RGB_COLOR & value)
 	{
 		GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 };
@@ -5233,8 +5230,7 @@
 	GdkColor color = _internal_color(value);
 
 	DW_MUTEX_LOCK;
-	if(!color.pixel)
-		gdk_color_alloc(_dw_cmap, &color);
+	gdk_color_alloc(_dw_cmap, &color);
 	_foreground[index] = color;
 	DW_MUTEX_UNLOCK;
 }
@@ -5251,8 +5247,12 @@
 	GdkColor color = _internal_color(value);
 
 	DW_MUTEX_LOCK;
-	if(!color.pixel)
-		gdk_color_alloc(_dw_cmap, &color);
+	gdk_color_alloc(_dw_cmap, &color);
+	if(value == DW_CLR_DEFAULT)
+		_transparent[index] = 1;
+	else
+		_transparent[index] = 0;
+
 	_background[index] = color;
 	DW_MUTEX_UNLOCK;
 }
@@ -5267,10 +5267,9 @@
 	gc = gdk_gc_new(window);
 	if(gc)
 	{
-		if(!_foreground[index].pixel)
-			gdk_gc_set_foreground(gc, &_foreground[index]);
-		if(!_background[index].pixel)
-			gdk_gc_set_background(gc, &_background[index]);
+		gdk_gc_set_foreground(gc, &_foreground[index]);
+		gdk_gc_set_background(gc, &_background[index]);
+		gdk_gc_set_colormap(gc, _dw_cmap);
 	}
 	return gc;
 }
@@ -5403,10 +5402,11 @@
 				{
 					int index = _find_thread_index(dw_thread_id());
 
+					gdk_pango_context_set_colormap(context, _dw_cmap);
 					pango_layout_set_font_description(layout, font);
 					pango_layout_set_text(layout, text, strlen(text));
 
-                    if(_background[index].pixel)
+                    if(_transparent[index])
 						gdk_draw_layout(handle ? handle->window : pixmap->pixmap, gc, x, y + 2, layout);
 					else
 						gdk_draw_layout_with_colors(handle ? handle->window : pixmap->pixmap, gc, x, y + 2, layout, &_foreground[index], &_background[index]);