changeset 21250:9187d331aebe

Add gnt_color_pair, which will replace color codes with 'appropriate' text attributes if the terminal doesn't support color. Fixes #3560. I have included the output of diffstat of the changeset. Do we like this in our commit message? If we do, we can use the stuff rekkanoryo has for gf. ---------------------------------------------------------------------- ChangeLog.API | 7 +++++++ finch/libgnt/gntbox.c | 10 +++++----- finch/libgnt/gntbutton.c | 3 ++- finch/libgnt/gntcheckbox.c | 4 ++-- finch/libgnt/gntcolors.c | 11 +++++++++++ finch/libgnt/gntcolors.h | 13 +++++++++++++ finch/libgnt/gntcombobox.c | 8 ++++---- finch/libgnt/gntentry.c | 4 ++-- finch/libgnt/gntline.c | 4 ++-- finch/libgnt/gntmain.c | 4 ++-- finch/libgnt/gntmenu.c | 4 ++-- finch/libgnt/gntslider.c | 10 +++++----- finch/libgnt/gnttextview.c | 14 +++++++------- finch/libgnt/gnttree.c | 37 ++++++++++++++++++------------------- finch/libgnt/gntwidget.c | 22 +++++++++++----------- finch/libgnt/gntwm.c | 4 ++-- finch/libgnt/gntws.c | 10 +++++----- 17 files changed, 100 insertions(+), 69 deletions(-)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 16 Oct 2007 09:51:12 +0000
parents 930d0b49ebcf
children 0110eb27b8b1
files ChangeLog.API finch/libgnt/gntbox.c finch/libgnt/gntbutton.c finch/libgnt/gntcheckbox.c finch/libgnt/gntcolors.c finch/libgnt/gntcolors.h finch/libgnt/gntcombobox.c finch/libgnt/gntentry.c finch/libgnt/gntline.c finch/libgnt/gntmain.c finch/libgnt/gntmenu.c finch/libgnt/gntslider.c finch/libgnt/gnttextview.c finch/libgnt/gnttree.c finch/libgnt/gntwidget.c finch/libgnt/gntwm.c finch/libgnt/gntws.c
diffstat 17 files changed, 100 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Tue Oct 16 04:14:54 2007 +0000
+++ b/ChangeLog.API	Tue Oct 16 09:51:12 2007 +0000
@@ -92,6 +92,13 @@
 		  PURPLE_TUNE_{ARTIST, TITLE, ALBUM, GENRE, COMMENT, TRACK, TIME,
 		  YEAR, URL} attributes.
 
+	Finch:
+		libgnt:
+		* Added gnt_color_pair, which will try to intelligenty set text
+		  attributes in place of colors if the terminal doesn't have color
+		  support. (Bug: #3560) All future code should use gnt_color_pair
+		  instead of COLOR_PAIR.
+
 version 2.2.2 (??/??/????):
 	libpurple:
 		Changed:
--- a/finch/libgnt/gntbox.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntbox.c	Tue Oct 16 09:51:12 2007 +0000
@@ -80,12 +80,12 @@
 		get_title_thingies(box, title, &pos, &right);
 
 		if (gnt_widget_has_focus(widget))
-			wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE));
+			wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TITLE));
 		else
-			wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE_D));
-		mvwaddch(widget->window, 0, pos-1, ACS_RTEE | COLOR_PAIR(GNT_COLOR_NORMAL));
+			wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TITLE_D));
+		mvwaddch(widget->window, 0, pos-1, ACS_RTEE | gnt_color_pair(GNT_COLOR_NORMAL));
 		mvwaddstr(widget->window, 0, pos, title);
-		mvwaddch(widget->window, 0, right, ACS_LTEE | COLOR_PAIR(GNT_COLOR_NORMAL));
+		mvwaddch(widget->window, 0, right, ACS_LTEE | gnt_color_pair(GNT_COLOR_NORMAL));
 		g_free(title);
 	}
 	
@@ -603,7 +603,7 @@
 		/* Erase the old title */
 		int pos, right;
 		get_title_thingies(b, prev, &pos, &right);
-		mvwhline(w->window, 0, pos - 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL),
+		mvwhline(w->window, 0, pos - 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL),
 				right - pos + 2);
 		g_free(prev);
 	}
--- a/finch/libgnt/gntbutton.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntbutton.c	Tue Oct 16 09:51:12 2007 +0000
@@ -47,7 +47,7 @@
 	else
 		type = GNT_COLOR_NORMAL;
 
-	wbkgdset(widget->window, '\0' | COLOR_PAIR(type));
+	wbkgdset(widget->window, '\0' | gnt_color_pair(type));
 	mvwaddstr(widget->window, (small_button) ? 0 : 1, 2, button->priv->text);
 	if (small_button) {
 		type = GNT_COLOR_HIGHLIGHT;
@@ -126,6 +126,7 @@
 	widget->priv.minh = small_button ? 1 : 3;
 	if (small_button)
 		GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
+	GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y);
 	GNTDEBUG;
 }
 
--- a/finch/libgnt/gntcheckbox.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntcheckbox.c	Tue Oct 16 09:51:12 2007 +0000
@@ -43,13 +43,13 @@
 	else
 		type = GNT_COLOR_NORMAL;
 	
-	wbkgdset(widget->window, '\0' | COLOR_PAIR(type));
+	wbkgdset(widget->window, '\0' | gnt_color_pair(type));
 
 	text = g_strdup_printf("[%c]", cb->checked ? 'X' : ' ');
 	mvwaddstr(widget->window, 0, 0, text);
 	g_free(text);
 
-	wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
 	mvwaddstr(widget->window, 0, 4, GNT_BUTTON(cb)->priv->text);
 	
 	GNTDEBUG;
--- a/finch/libgnt/gntcolors.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntcolors.c	Tue Oct 16 09:51:12 2007 +0000
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+static gboolean hascolors;
 static struct
 {
 	short r, g, b;
@@ -75,6 +76,8 @@
 	init = TRUE;
 
 	start_color();
+	if (!(hascolors = has_colors()))
+		return;
 	defaults = use_default_colors();
 
 	if (can_use_custom_color())
@@ -276,3 +279,11 @@
 }
 
 #endif  /* GKeyFile */
+
+int gnt_color_pair(int pair)
+{
+	return (hascolors ? COLOR_PAIR(pair) :
+		((pair == GNT_COLOR_NORMAL || pair == GNT_COLOR_HIGHLIGHT_D ||
+		  pair == GNT_COLOR_TITLE_D || pair == GNT_COLOR_DISABLED) ? 0 : A_STANDOUT));
+}
+
--- a/finch/libgnt/gntcolors.h	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntcolors.h	Tue Oct 16 09:51:12 2007 +0000
@@ -88,4 +88,17 @@
 
 #endif
 
+/**
+ * Return the appropriate character attribute for a specified color.
+ * If the terminal doesn't have color support, this returns A_STANDOUT
+ * when deemed appropriate.
+ *
+ * @param color   The color code.
+ *
+ * @return  A character attribute.
+ *
+ * @since 2.3.0
+ */
+int gnt_color_pair(int pair);
+
 #endif
--- a/finch/libgnt/gntcombobox.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntcombobox.c	Tue Oct 16 09:51:12 2007 +0000
@@ -85,15 +85,15 @@
 	else
 		type = GNT_COLOR_NORMAL;
 
-	wbkgdset(widget->window, '\0' | COLOR_PAIR(type));
+	wbkgdset(widget->window, '\0' | gnt_color_pair(type));
 
 	s = (char*)gnt_util_onscreen_width_to_pointer(text, widget->priv.width - 4, &len);
 	*s = '\0';
 
 	mvwaddstr(widget->window, 1, 1, text);
-	whline(widget->window, ' ' | COLOR_PAIR(type), widget->priv.width - 4 - len);
-	mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL));
-	mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | COLOR_PAIR(GNT_COLOR_NORMAL));
+	whline(widget->window, ' ' | gnt_color_pair(type), widget->priv.width - 4 - len);
+	mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL));
+	mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | gnt_color_pair(GNT_COLOR_NORMAL));
 
 	g_free(text);
 	GNTDEBUG;
--- a/finch/libgnt/gntentry.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntentry.c	Tue Oct 16 09:51:12 2007 +0000
@@ -201,9 +201,9 @@
 	gboolean focus;
 
 	if ((focus = gnt_widget_has_focus(widget)))
-		wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TEXT_NORMAL));
+		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TEXT_NORMAL));
 	else
-		wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D));
+		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
 
 	if (entry->masked)
 	{
--- a/finch/libgnt/gntline.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntline.c	Tue Oct 16 09:51:12 2007 +0000
@@ -40,10 +40,10 @@
 {
 	GntLine *line = GNT_LINE(widget);
 	if (line->vertical)
-		mvwvline(widget->window, 1, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL),
+		mvwvline(widget->window, 1, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL),
 				widget->priv.height - 2);
 	else
-		mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL),
+		mvwhline(widget->window, 0, 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL),
 				widget->priv.width - 2);
 }
 
--- a/finch/libgnt/gntmain.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntmain.c	Tue Oct 16 09:51:12 2007 +0000
@@ -482,7 +482,7 @@
 
 	gnt_init_colors();
 
-	wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgdset(stdscr, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
 	refresh();
 
 #ifdef ALL_MOUSE_EVENTS
@@ -490,7 +490,7 @@
 		mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL);
 #endif
 
-	wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgdset(stdscr, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
 	werase(stdscr);
 	wrefresh(stdscr);
 
--- a/finch/libgnt/gntmenu.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntmenu.c	Tue Oct 16 09:51:12 2007 +0000
@@ -56,12 +56,12 @@
 	int i;
 
 	if (menu->type == GNT_MENU_TOPLEVEL) {
-		wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT));
+		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT));
 		werase(widget->window);
 
 		for (i = 0, iter = menu->list; iter; iter = iter->next, i++) {
 			GntMenuItem *item = GNT_MENU_ITEM(iter->data);
-			type = ' ' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT);
+			type = ' ' | gnt_color_pair(GNT_COLOR_HIGHLIGHT);
 			if (i == menu->selected)
 				type |= A_REVERSE;
 			item->priv.x = getcurx(widget->window) + widget->priv.x;
--- a/finch/libgnt/gntslider.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntslider.c	Tue Oct 16 09:51:12 2007 +0000
@@ -84,21 +84,21 @@
 	else
 		position = 0;
 	if (slider->vertical) {
-		mvwvline(widget->window, size-position, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL) | A_BOLD,
+		mvwvline(widget->window, size-position, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL) | A_BOLD,
 				position);
-		mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL),
+		mvwvline(widget->window, 0, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL),
 				size-position);
 	} else {
-		mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL) | A_BOLD,
+		mvwhline(widget->window, 0, 0, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL) | A_BOLD,
 				position);
-		mvwhline(widget->window, 0, position, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL),
+		mvwhline(widget->window, 0, position, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL),
 				size - position);
 	}
 
 	mvwaddch(widget->window,
 			slider->vertical ? (size - position - 1) : 0,
 			slider->vertical ? 0 : position,
-			ACS_CKBOARD | COLOR_PAIR(attr));
+			ACS_CKBOARD | gnt_color_pair(attr));
 }
 
 static void
--- a/finch/libgnt/gnttextview.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gnttextview.c	Tue Oct 16 09:51:12 2007 +0000
@@ -71,7 +71,7 @@
 	int comp = 0;          /* Used for top-aligned text */
 	gboolean has_scroll = !(view->flags & GNT_TEXT_VIEW_NO_SCROLL);
 
-	wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL));
 	werase(widget->window);
 
 	if ((view->flags & GNT_TEXT_VIEW_TOP_ALIGN) &&
@@ -158,15 +158,15 @@
 			position = rows - showing;
 
 		mvwvline(widget->window, position + 1, scrcol,
-				ACS_CKBOARD | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D), showing);
+				ACS_CKBOARD | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D), showing);
 	}
 
 	if (has_scroll) {
 		mvwaddch(widget->window, 0, scrcol,
-				(lines ? ACS_UARROW : ' ') | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D));
+				(lines ? ACS_UARROW : ' ') | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
 		mvwaddch(widget->window, widget->priv.height - 1, scrcol,
 				((view->list && view->list->prev) ? ACS_DARROW : ' ') |
-					COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D));
+					gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
 	}
 
 	GNTDEBUG;
@@ -645,11 +645,11 @@
 		fl |= A_BLINK;
 
 	if (flags & GNT_TEXT_FLAG_DIM)
-		fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_DISABLED));
+		fl |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED));
 	else if (flags & GNT_TEXT_FLAG_HIGHLIGHT)
-		fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_HIGHLIGHT));
+		fl |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT));
 	else
-		fl |= COLOR_PAIR(GNT_COLOR_NORMAL);
+		fl |= gnt_color_pair(GNT_COLOR_NORMAL);
 
 	return fl;
 }
--- a/finch/libgnt/gnttree.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gnttree.c	Tue Oct 16 09:51:12 2007 +0000
@@ -432,7 +432,7 @@
 		tree_selection_changed(tree, NULL, tree->current);
 	}
 
-	wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL));
 
 	start = 0;
 	if (tree->show_title)
@@ -440,9 +440,9 @@
 		int i;
 		int x = pos;
 
-		mvwhline(widget->window, pos + 1, pos, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL),
+		mvwhline(widget->window, pos + 1, pos, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL),
 				widget->priv.width - pos - 1);
-		mvwhline(widget->window, pos, pos, ' ' | COLOR_PAIR(GNT_COLOR_NORMAL),
+		mvwhline(widget->window, pos, pos, ' ' | gnt_color_pair(GNT_COLOR_NORMAL),
 				widget->priv.width - pos - 1);
 
 		for (i = 0; i < tree->ncol; i++)
@@ -455,14 +455,14 @@
 		}
 		if (pos)
 		{
-			tree_mark_columns(tree, pos, 0, ACS_TTEE | COLOR_PAIR(GNT_COLOR_NORMAL));
+			tree_mark_columns(tree, pos, 0, ACS_TTEE | gnt_color_pair(GNT_COLOR_NORMAL));
 			tree_mark_columns(tree, pos, widget->priv.height - pos,
-					ACS_BTEE | COLOR_PAIR(GNT_COLOR_NORMAL));
+					ACS_BTEE | gnt_color_pair(GNT_COLOR_NORMAL));
 		}
 		tree_mark_columns(tree, pos, pos + 1,
-			(tree->show_separator ? ACS_PLUS : ACS_HLINE) | COLOR_PAIR(GNT_COLOR_NORMAL));
+			(tree->show_separator ? ACS_PLUS : ACS_HLINE) | gnt_color_pair(GNT_COLOR_NORMAL));
 		tree_mark_columns(tree, pos, pos,
-			(tree->show_separator ? ACS_VLINE : ' ') | COLOR_PAIR(GNT_COLOR_NORMAL));
+			(tree->show_separator ? ACS_VLINE : ' ') | gnt_color_pair(GNT_COLOR_NORMAL));
 		start = 2;
 	}
 
@@ -514,18 +514,18 @@
 		if (row == tree->current)
 		{
 			if (gnt_widget_has_focus(widget))
-				attr |= COLOR_PAIR(GNT_COLOR_HIGHLIGHT);
+				attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT);
 			else
-				attr |= COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D);
+				attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT_D);
 		}
 		else
 		{
 			if (flags & GNT_TEXT_FLAG_DIM)
-				attr |= (A_DIM | COLOR_PAIR(GNT_COLOR_DISABLED));
+				attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED));
 			else if (flags & GNT_TEXT_FLAG_HIGHLIGHT)
-				attr |= (A_DIM | COLOR_PAIR(GNT_COLOR_HIGHLIGHT));
+				attr |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT));
 			else
-				attr |= COLOR_PAIR(GNT_COLOR_NORMAL);
+				attr |= gnt_color_pair(GNT_COLOR_NORMAL);
 		}
 
 		wbkgdset(widget->window, '\0' | attr);
@@ -537,7 +537,7 @@
 			(tree->show_separator ? ACS_VLINE : ' ') | attr);
 	}
 
-	wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
 	while (i < widget->priv.height - pos)
 	{
 		mvwhline(widget->window, i, pos, ' ',
@@ -576,22 +576,22 @@
 		position += pos + start + 1;
 
 		mvwvline(widget->window, pos + start + 1, scrcol,
-				' ' | COLOR_PAIR(GNT_COLOR_NORMAL), rows);
+				' ' | gnt_color_pair(GNT_COLOR_NORMAL), rows);
 		mvwvline(widget->window, position, scrcol,
-				ACS_CKBOARD | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D), showing);
+				ACS_CKBOARD | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D), showing);
 	}
 
 	mvwaddch(widget->window, start + pos, scrcol,
 			((tree->top != tree->root) ?  ACS_UARROW : ' ') |
-				COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D));
+				gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
 
 	mvwaddch(widget->window, widget->priv.height - pos - 1, scrcol,
-			(row ?  ACS_DARROW : ' ') | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D));
+			(row ?  ACS_DARROW : ' ') | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
 
 	/* If there's a search-text, show it in the bottom of the tree */
 	if (tree->priv->search && tree->priv->search->len > 0) {
 		const char *str = gnt_util_onscreen_width_to_pointer(tree->priv->search->str, scrcol - 1, NULL);
-		wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D));
+		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
 		mvwaddnstr(widget->window, widget->priv.height - pos - 1, pos,
 				tree->priv->search->str, str - tree->priv->search->str);
 	}
@@ -1328,7 +1328,6 @@
 			tree->list = g_list_insert(tree->list, key, position + 1);
 		}
 	}
-
 	redraw_tree(tree);
 
 	return row;
--- a/finch/libgnt/gntwidget.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntwidget.c	Tue Oct 16 09:51:12 2007 +0000
@@ -420,7 +420,7 @@
 gnt_widget_hide(GntWidget *widget)
 {
 	g_signal_emit(widget, signals[SIG_HIDE], 0);
-	wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
 #if 0
 	/* XXX: I have no clue why, but this seemed to be necessary. */
 	if (gnt_widget_has_shadow(widget))
@@ -477,31 +477,31 @@
 	if (!gnt_widget_has_shadow(widget))
 		shadow = FALSE;
 
-	wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL));
 	werase(widget->window);
 
 	if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER))
 	{
 		/* - This is ugly. */
 		/* - What's your point? */
-		mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height);
+		mvwvline(widget->window, 0, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.height);
 		mvwvline(widget->window, 0, widget->priv.width - 1,
-				ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height);
+				ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.height);
 		mvwhline(widget->window, widget->priv.height - 1, 0,
-				ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width);
-		mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width);
-		mvwaddch(widget->window, 0, 0, ACS_ULCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
+				ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width);
+		mvwhline(widget->window, 0, 0, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width);
+		mvwaddch(widget->window, 0, 0, ACS_ULCORNER | gnt_color_pair(GNT_COLOR_NORMAL));
 		mvwaddch(widget->window, 0, widget->priv.width - 1,
-				ACS_URCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
+				ACS_URCORNER | gnt_color_pair(GNT_COLOR_NORMAL));
 		mvwaddch(widget->window, widget->priv.height - 1, 0,
-				ACS_LLCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
+				ACS_LLCORNER | gnt_color_pair(GNT_COLOR_NORMAL));
 		mvwaddch(widget->window, widget->priv.height - 1, widget->priv.width - 1,
-				ACS_LRCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
+				ACS_LRCORNER | gnt_color_pair(GNT_COLOR_NORMAL));
 	}
 
 	if (shadow)
 	{
-		wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_SHADOW));
+		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_SHADOW));
 		mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height);
 		mvwhline(widget->window, widget->priv.height, 1, ' ', widget->priv.width);
 	}
--- a/finch/libgnt/gntwm.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntwm.c	Tue Oct 16 09:51:12 2007 +0000
@@ -1046,7 +1046,7 @@
 	GntWM *wm = GNT_WM(wim);
 	GntWidget *w = GNT_WIDGET(wid);
 	wm->tagged = g_list_remove(wm->tagged, w);
-	mvwhline(w->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), 3);
+	mvwhline(w->window, 0, 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), 3);
 	gnt_widget_draw(w);
 }
 
@@ -1066,7 +1066,7 @@
 	}
 
 	wm->tagged = g_list_prepend(wm->tagged, widget);
-	wbkgdset(widget->window, ' ' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT));
+	wbkgdset(widget->window, ' ' | gnt_color_pair(GNT_COLOR_HIGHLIGHT));
 	mvwprintw(widget->window, 0, 1, "[T]");
 	gnt_widget_draw(widget);
 	return TRUE;
--- a/finch/libgnt/gntws.c	Tue Oct 16 04:14:54 2007 +0000
+++ b/finch/libgnt/gntws.c	Tue Oct 16 09:51:12 2007 +0000
@@ -45,7 +45,7 @@
 		mvwin(taskbar, Y_MAX, 0);
 	}
 
-	wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
+	wbkgdset(taskbar, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
 	werase(taskbar);
 
 	n = g_list_length(ws->list);
@@ -66,15 +66,15 @@
 		} else {
 			color = GNT_COLOR_NORMAL;
 		}
-		wbkgdset(taskbar, '\0' | COLOR_PAIR(color));
+		wbkgdset(taskbar, '\0' | gnt_color_pair(color));
 		if (iter->next)
-			mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width);
+			mvwhline(taskbar, 0, width * i, ' ' | gnt_color_pair(color), width);
 		else
-			mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), getmaxx(stdscr) - width * i);
+			mvwhline(taskbar, 0, width * i, ' ' | gnt_color_pair(color), getmaxx(stdscr) - width * i);
 		title = GNT_BOX(w)->title;
 		mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>");
 		if (i)
-			mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | COLOR_PAIR(GNT_COLOR_NORMAL));
+			mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | gnt_color_pair(GNT_COLOR_NORMAL));
 	}
 	wrefresh(taskbar);
 }