Try to reuse an existing color.

Sun, 02 Dec 2007 07:16:05 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Sun, 02 Dec 2007 07:16:05 +0000
changeset 21838
5cbcf3668bfa
parent 21837
16cb747fcda5
child 21839
68d16b8f4d48
child 21856
3b5993099595

Try to reuse an existing color.

finch/libgnt/gntcolors.c file | annotate | diff | comparison | revisions
--- a/finch/libgnt/gntcolors.c	Sun Dec 02 06:01:52 2007 +0000
+++ b/finch/libgnt/gntcolors.c	Sun Dec 02 07:16:05 2007 +0000
@@ -294,6 +294,13 @@
 
 int gnt_color_add_pair(int fg, int bg)
 {
+	int i;
+	for (i = 1; i < custom_type; i++) {
+		short f, b;
+		if (pair_content(i, &f, &b) != ERR &&
+				f == fg && b == bg)
+			return i;
+	}
 	init_pair(custom_type, fg, bg);
 	return custom_type++;
 }

mercurial