[vte] Fix palette handling



commit 75809e632eb097c8a96c855781677cee560978eb
Author: Behdad Esfahbod <behdad behdad org>
Date:   Mon Sep 7 01:15:55 2009 -0400

    Fix palette handling

 src/ring.h        |    1 +
 src/vte-private.h |    2 +-
 src/vte.c         |    5 +++--
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/ring.h b/src/ring.h
index db72d66..5eb41ba 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -35,6 +35,7 @@ G_BEGIN_DECLS
 #define VTE_DIM_FG			259
 #define VTE_DEF_HL                      260
 #define VTE_CUR_BG			261
+#define VTE_PALETTE_SIZE		262
 
 #define FRAGMENT			-2
 
diff --git a/src/vte-private.h b/src/vte-private.h
index 24702bc..c6041aa 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -334,7 +334,7 @@ struct _VteTerminalPrivate {
 	gboolean cursor_color_set;
 	struct vte_palette_entry {
 		guint16 red, green, blue;
-	} palette[VTE_CUR_BG + 1];
+	} palette[VTE_PALETTE_SIZE];
 
 	/* Mouse cursors. */
 	gboolean mouse_cursor_visible;
diff --git a/src/vte.c b/src/vte.c
index 68832c0..653c3aa 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2632,7 +2632,8 @@ vte_terminal_set_color_highlight(VteTerminal *terminal,
  * color, an eight color palette, bold versions of the eight color palette,
  * and a dim version of the the eight color palette.
  *
- * @palette_size must be either 0, 8, 16, or 24.  If @foreground is %NULL and
+ * @palette_size must be either 0, 8, 16, or 24, or between 25 and 255 inclusive.
+ * If @foreground is %NULL and
  * @palette_size is greater than 0, the new foreground color is taken from
  * @palette[7].  If @background is %NULL and @palette_size is greater than 0,
  * the new background color is taken from @palette[0].  If
@@ -2658,7 +2659,7 @@ vte_terminal_set_colors(VteTerminal *terminal,
 			 (palette_size == 8) ||
 			 (palette_size == 16) ||
 			 (palette_size == 24) ||
-			 (palette_size == G_N_ELEMENTS(terminal->pvt->palette)));
+			 (palette_size > 24 && palette_size < 256));
 
 	_vte_debug_print(VTE_DEBUG_MISC,
 			"Set color palette [%ld elements].\n",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]