im.pidgin.pidgin.next.minor: badd0da928af665635b29e3c49bb7d8de8d93b3c

sadrul at pidgin.im sadrul at pidgin.im
Tue Oct 16 05:50:39 EDT 2007


-----------------------------------------------------------------
Revision: badd0da928af665635b29e3c49bb7d8de8d93b3c
Ancestor: ee7b48477e49af5ca9147906f381091c7f05d2da
Author: sadrul at pidgin.im
Date: 2007-10-16T09:51:12
Branch: im.pidgin.pidgin.next.minor

Modified 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

ChangeLog: 

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(-)


-------------- next part --------------
============================================================
--- ChangeLog.API	549407aaae01d2e6ad005ef238b408d0ef822d98
+++ ChangeLog.API	b8a05906963b42ca84e963a565403d5dd055a2c6
@@ -92,6 +92,13 @@ version 2.3.0 (??/??/????):
 		  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:
============================================================
--- finch/libgnt/gntbox.c	6fd1efb3e60fcdde6cbf7827e8069466f283dfcb
+++ finch/libgnt/gntbox.c	9227cafb184ad4724d054ca82a5d451f0e87f812
@@ -80,12 +80,12 @@ gnt_box_draw(GntWidget *widget)
 		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 @@ void gnt_box_set_title(GntBox *b, const 
 		/* 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);
 	}
============================================================
--- finch/libgnt/gntbutton.c	78baddb77f10483431ba0c4c91f5fb45e1ba71a0
+++ finch/libgnt/gntbutton.c	44cb5ee19114509550f899c90310cae65fd5ebc3
@@ -47,7 +47,7 @@ gnt_button_draw(GntWidget *widget)
 	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 @@ gnt_button_init(GTypeInstance *instance,
 	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;
 }
 
============================================================
--- finch/libgnt/gntcheckbox.c	08f30c4d06c82a85fcbd5dbf50c6f9ae720b524c
+++ finch/libgnt/gntcheckbox.c	d01f639e77038f36a469bde84b31f96d23a426c8
@@ -43,13 +43,13 @@ gnt_check_box_draw(GntWidget *widget)
 	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;
============================================================
--- finch/libgnt/gntcolors.c	97d5cb72747f2ba9e1921b091f574a77542b74a2
+++ finch/libgnt/gntcolors.c	aa0b5937604bbcfcfd9460f69438dda542a77040
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+static gboolean hascolors;
 static struct
 {
 	short r, g, b;
@@ -75,6 +76,8 @@ void gnt_init_colors()
 	init = TRUE;
 
 	start_color();
+	if (!(hascolors = has_colors()))
+		return;
 	defaults = use_default_colors();
 
 	if (can_use_custom_color())
@@ -276,3 +279,11 @@ void gnt_color_pairs_parse(GKeyFile *kfi
 }
 
 #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));
+}
+
============================================================
--- finch/libgnt/gntcolors.h	04bc7db0d7de7d04ad866ce58e3dafdf87631b9c
+++ finch/libgnt/gntcolors.h	744c5ece28dc85433b7346c1d9a6f5730b62a415
@@ -88,4 +88,17 @@ void gnt_color_pairs_parse(GKeyFile *kfi
 
 #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
============================================================
--- finch/libgnt/gntcombobox.c	41b55ca896682a25b7064c99ae123845f5b2574c
+++ finch/libgnt/gntcombobox.c	3f04f2a89f6b9226915cb23f715cf032d5a31276
@@ -85,15 +85,15 @@ gnt_combo_box_draw(GntWidget *widget)
 	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;
============================================================
--- finch/libgnt/gntentry.c	5551a12c1cfb74ba91c21705c24c0ebcaca53425
+++ finch/libgnt/gntentry.c	e5767b93f57ae9817a6ce5a63873029e4be9749a
@@ -201,9 +201,9 @@ gnt_entry_draw(GntWidget *widget)
 	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)
 	{
============================================================
--- finch/libgnt/gntline.c	56082bf588ff8588af9c92263f4c02e3af68adca
+++ finch/libgnt/gntline.c	c0a1fcae1d58d9eb3e8047b505e341ea0a5ccb8f
@@ -40,10 +40,10 @@ gnt_line_draw(GntWidget *widget)
 {
 	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);
 }
 
============================================================
--- finch/libgnt/gntmain.c	7ddfbc8f64142c8b3f27e408710c3e096e961fdd
+++ finch/libgnt/gntmain.c	ed2bcf1f9ba036e7ef89debcd99944d14a896058
@@ -482,7 +482,7 @@ void gnt_init()
 
 	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 @@ void gnt_init()
 		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);
 
============================================================
--- finch/libgnt/gntmenu.c	f8a549e1774f40d117f90f59d5b17e9691170440
+++ finch/libgnt/gntmenu.c	70c40d772370f9b7f3e9beb1513ab0e089ec600f
@@ -56,12 +56,12 @@ gnt_menu_draw(GntWidget *widget)
 	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;
============================================================
--- finch/libgnt/gntslider.c	79eedc68a72e60bc6ca56ede59c53966a4dc7df0
+++ finch/libgnt/gntslider.c	84297380ffcee7a81fc5f1260a881b4669625bad
@@ -84,21 +84,21 @@ gnt_slider_draw(GntWidget *widget)
 	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
============================================================
--- finch/libgnt/gnttextview.c	66c6ae9b4e38fd1015de49775c9c26f13b07d58a
+++ finch/libgnt/gnttextview.c	caf71aeb5075808f16bfb297661b30ae11ca3450
@@ -71,7 +71,7 @@ gnt_text_view_draw(GntWidget *widget)
 	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 @@ gnt_text_view_draw(GntWidget *widget)
 			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 @@ chtype gnt_text_format_flag_to_chtype(Gn
 		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;
 }
============================================================
--- finch/libgnt/gnttree.c	be8a77ee722c4615fac5656740ba2a20ecf8d3cf
+++ finch/libgnt/gnttree.c	603608828a6bd34641df3b14064e3e579e98ca88
@@ -432,7 +432,7 @@ redraw_tree(GntTree *tree)
 		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 @@ redraw_tree(GntTree *tree)
 		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 @@ redraw_tree(GntTree *tree)
 		}
 		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 @@ redraw_tree(GntTree *tree)
 		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 @@ redraw_tree(GntTree *tree)
 			(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 @@ redraw_tree(GntTree *tree)
 		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 @@ GntTreeRow *gnt_tree_add_row_after(GntTr
 			tree->list = g_list_insert(tree->list, key, position + 1);
 		}
 	}
-
 	redraw_tree(tree);
 
 	return row;
============================================================
--- finch/libgnt/gntwidget.c	63a45f2a1c67c8092a3d4063039c04873cdfff1a
+++ finch/libgnt/gntwidget.c	ec60d0dc63f26ad51bbe602b132c34021c46f7d6
@@ -420,7 +420,7 @@ gnt_widget_hide(GntWidget *widget)
 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 @@ init_widget(GntWidget *widget)
 	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);
 	}
============================================================
--- finch/libgnt/gntwm.c	9e4d7cd2c769dc9b54f1367adb2738af86d1d2ca
+++ finch/libgnt/gntwm.c	bae2180ba819ed517cf585dd4e7a5001104838d2
@@ -1046,7 +1046,7 @@ static void remove_tag(gpointer wid, gpo
 	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 @@ tag_widget(GntBindable *b, GList *params
 	}
 
 	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;
============================================================
--- finch/libgnt/gntws.c	d784f65adf47f3e74ee6471fb00e57dfb77788d4
+++ finch/libgnt/gntws.c	5e1633ea5d23133783442c311ed31fd7a94658ef
@@ -45,7 +45,7 @@ gnt_ws_draw_taskbar(GntWS *ws, gboolean 
 		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 @@ gnt_ws_draw_taskbar(GntWS *ws, gboolean 
 		} 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);
 }


More information about the Commits mailing list