Index: python/vte.defs
===================================================================
RCS file: /cvs/gnome/vte/python/vte.defs,v
retrieving revision 1.8
diff -u -r1.8 vte.defs
--- python/vte.defs	15 Oct 2002 02:22:35 -0000	1.8
+++ python/vte.defs	22 Oct 2002 01:01:31 -0000
@@ -201,6 +201,7 @@
   (parameters
     '("const-GdkColor*" "foreground")
     '("const-GdkColor*" "background")
+    '("const-GdkColor*" "cursor")
     '("const-GdkColor*" "palette")
     '("glong" "palette_size")
   )
Index: src/vte.c
===================================================================
RCS file: /cvs/gnome/vte/src/vte.c,v
retrieving revision 1.237
diff -u -r1.237 vte.c
--- src/vte.c	18 Oct 2002 21:58:33 -0000	1.237
+++ src/vte.c	22 Oct 2002 01:01:35 -0000
@@ -91,6 +91,7 @@
 #define VTE_DEF_FG			16
 #define VTE_DEF_BG			(VTE_DEF_FG + 1)
 #define VTE_BOLD_FG			(VTE_DEF_BG + 1)
+#define VTE_CURSOR_COLOR		(VTE_BOLD_FG + 1)
 #define VTE_SATURATION_MAX		10000
 #define VTE_SCROLLBACK_MIN		100
 #define VTE_DEFAULT_EMULATION		"xterm"
@@ -333,7 +334,7 @@
 		XftColor ftcolor;
 		gboolean ftcolor_allocated;
 #endif
-	} palette[VTE_BOLD_FG + 1];
+	} palette[VTE_CURSOR_COLOR + 1];
 
 	/* Mouse cursors. */
 	GdkCursor *mouse_default_cursor,
@@ -5345,7 +5346,7 @@
 	{"application-keypad", vte_sequence_handler_application_keypad},
 	{"change-background-colors", NULL},
 	{"change-color", NULL},
-	{"change-cursor-colors", NULL},
+	{"change-cursor-colors", NULL},		/* FIXME: use this */
 	{"change-font-name", NULL},
 	{"change-font-number", NULL},
 	{"change-foreground-colors", NULL},
@@ -5638,6 +5639,7 @@
  * @terminal: a #VteTerminal
  * @foreground: the new foreground color, or #NULL
  * @background: the new background color, or #NULL
+ * @cursor: the new cursor color, or #NULL
  * @palette: the color palette
  * @palette_size: the number of entries in @palette
  *
@@ -5657,6 +5659,7 @@
 vte_terminal_set_colors(VteTerminal *terminal,
 			const GdkColor *foreground,
 			const GdkColor *background,
+			const GdkColor *cursor,
 			const GdkColor *palette,
 			glong palette_size)
 {
@@ -5735,6 +5738,15 @@
 				color.red += 0x3fff;
 			}
 			break;
+		case VTE_CURSOR_COLOR:
+			if (cursor != NULL) {
+				color = *cursor;
+			} else {
+				color.red = 0xaaaa;
+				color.blue = 0;
+				color.green = 0;
+			}
+			break;
 		default:
 			g_assert_not_reached();
 			break;
@@ -5749,6 +5761,12 @@
 		vte_terminal_set_color_internal(terminal, i, &color);
 	}
 
+	/* Set up the cursor color entry. */
+	if (cursor) {
+		vte_terminal_set_color_internal(terminal, VTE_CURSOR_COLOR,
+						cursor);
+	}
+
 	/* We may just have changed the default background color, so queue
 	 * a repaint of the entire viewable area. */
 	vte_invalidate_all(terminal);
@@ -5767,7 +5785,7 @@
 void
 vte_terminal_set_default_colors(VteTerminal *terminal)
 {
-	vte_terminal_set_colors(terminal, NULL, NULL, NULL, 0);
+	vte_terminal_set_colors(terminal, NULL, NULL, NULL, NULL, 0);
 }
 
 /* Insert a single character into the stored data array. */
@@ -10903,7 +10921,7 @@
 static void
 vte_terminal_determine_colors(VteTerminal *terminal,
 			      const struct vte_charcell *cell, gboolean reverse,
-			      int *fore, int *back)
+			      gboolean cursor, int *fore, int *back)
 {
 	/* Determine what the foreground and background colors for rendering
 	 * text should be. */
@@ -10932,6 +10950,10 @@
 			*back += VTE_COLOR_BRIGHT_OFFSET;
 		}
 	}
+	if (cursor && reverse && terminal->pvt->cursor_visible) {
+		*fore = *back;
+		*back = VTE_CURSOR_COLOR;
+	}
 }
 
 #if HAVE_XFT
@@ -12125,7 +12147,7 @@
 		reverse = vte_cell_is_selected(terminal, i, row) ^
 			  terminal->pvt->screen->reverse_mode;
 		vte_terminal_determine_colors(terminal, cell, reverse,
-					      &fore, &back);
+					      FALSE, &fore, &back);
 		underline = (cell != NULL) ? (cell->underline != 0) : FALSE;
 		bold = (cell != NULL) ? (cell->bold != 0) : FALSE;
 		if ((cell != NULL) && (terminal->pvt->match_contents != NULL)) {
@@ -12192,7 +12214,7 @@
 			reverse = vte_cell_is_selected(terminal, j, row) ^
 				  terminal->pvt->screen->reverse_mode;
 			vte_terminal_determine_colors(terminal, cell, reverse,
-						      &nfore, &nback);
+						      FALSE, &nfore, &nback);
 			if ((nfore != fore) || (nback != back)) {
 				break;
 			}
@@ -12414,7 +12436,7 @@
 			blink = vte_terminal_get_blink_state(terminal) ^
 				terminal->pvt->screen->reverse_mode;
 			vte_terminal_determine_colors(terminal, cell, blink,
-						      &fore, &back);
+						      TRUE, &fore, &back);
 			if ((cell != NULL) &&
 			    (cell->alternate || vte_unichar_isgraphic(cell->c))) {
 				vte_terminal_draw_graphic(terminal,
@@ -12462,9 +12484,10 @@
 				columns = cell->columns;
 			}
 			/* Draw it as a hollow rectangle. */
-			fore = cell ? cell->fore : VTE_DEF_FG;
+			vte_terminal_determine_colors(terminal, cell, TRUE,
+						      TRUE, &fore, &back);
 			XSetForeground(display, gc,
-				       terminal->pvt->palette[fore].pixel);
+				       terminal->pvt->palette[back].pixel);
 			XDrawRectangle(display, drawable, gc,
 				       col * width - x_offs + VTE_PAD_WIDTH,
 				       row * height - y_offs + VTE_PAD_WIDTH,
Index: src/vte.h
===================================================================
RCS file: /cvs/gnome/vte/src/vte.h,v
retrieving revision 1.51
diff -u -r1.51 vte.h
--- src/vte.h	15 Oct 2002 02:22:37 -0000	1.51
+++ src/vte.h	22 Oct 2002 01:01:35 -0000
@@ -179,6 +179,7 @@
 void vte_terminal_set_colors(VteTerminal *terminal,
 			     const GdkColor *foreground,
 			     const GdkColor *background,
+			     const GdkColor *cursor,
 			     const GdkColor *palette,
 			     glong palette_size);
 void vte_terminal_set_default_colors(VteTerminal *terminal);
Index: src/vteapp.c
===================================================================
RCS file: /cvs/gnome/vte/src/vteapp.c,v
retrieving revision 1.42
diff -u -r1.42 vteapp.c
--- src/vteapp.c	16 Oct 2002 19:37:03 -0000	1.42
+++ src/vteapp.c	22 Oct 2002 01:01:35 -0000
@@ -110,7 +110,7 @@
 	int opt;
 	int i, j;
 	GList *args = NULL;
-	GdkColor fore, back;
+	GdkColor fore, back, curs;
 	const char *usage = "Usage: %s "
 			    "[ [-B image] | [-T] ] "
 			    "[-D] "
@@ -125,6 +125,7 @@
 			    "[-t terminaltype]\n";
 	back.red = back.green = back.blue = 0xffff;
 	fore.red = fore.green = fore.blue = 0x0000;
+	curs.red = curs.green = curs.blue = 0xaaaa;
 
 	/* Have to do this early. */
 	if (getenv("VTE_PROFILE_MEMORY")) {
@@ -257,7 +258,8 @@
 		vte_terminal_set_background_transparent(VTE_TERMINAL(widget),
 							TRUE);
 	}
-	vte_terminal_set_colors(VTE_TERMINAL(widget), &fore, &back, NULL, 0);
+	vte_terminal_set_colors(VTE_TERMINAL(widget), &fore, &back, &curs,
+				NULL, 0);
 	if (terminal != NULL) {
 		vte_terminal_set_emulation(VTE_TERMINAL(widget), terminal);
 	}
