Bug#406367: [PATCH] use color instead of dim attribute for the curses driver

2007-01-11 Thread Thomas Dickey
On Wed, Jan 10, 2007 at 08:10:14PM +0100, Jindrich Makovicka wrote:
 Package: aalib
 Version: 1.4p5-30
 
 Hi,
 
 the attached patch makes the aacurses driver use black on black + bold
 for the dim letters instead of the dim attribute, if the color is
 available on the terminal. The reason is that A_DIM is ignored by linux
 console and most of the X terminals I am aware off, and linux console

A_DIM is ignored is backwards (for X terminals).
The terminal description for those do not state that the terminal
supports the feature.  Masking in A_DIM will fail for the same reason
that attempting to use color on a monochrome terminal will fail.

For Linux console - whether dim is actually implemented appears to
depend on the configuration (and fonts ;-).

Drawing black-on-black is guaranteed to be nonportable.
Writing a terminal description that corresponds to the particular
configuration that you are attempting to support is the way to go.

 also reports that this attribute is supported, while rendering it the
 same way as normal color. With this patch, all (3) levels of brightness
 can be successfully utilized on the console :)
 
 Regards,
 -- 
 Jindrich Makovicka



-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


pgpisT7vSeZcF.pgp
Description: PGP signature


Bug#406367: [PATCH] use color instead of dim attribute for the curses driver

2007-01-10 Thread Joey Hess
The other problem with the patch is that the slang driver is used by
default at the console BTW.

-- 
see shy jo


signature.asc
Description: Digital signature


Bug#406367: [PATCH] use color instead of dim attribute for the curses driver

2007-01-10 Thread Joey Hess
Jindrich Makovicka wrote:
 the attached patch makes the aacurses driver use black on black + bold
 for the dim letters instead of the dim attribute, if the color is
 available on the terminal. The reason is that A_DIM is ignored by linux
 console and most of the X terminals I am aware off, and linux console
 also reports that this attribute is supported, while rendering it the
 same way as normal color. With this patch, all (3) levels of brightness
 can be successfully utilized on the console :)

This does not seem to work very well. I've attached a screenshot of two
aafire's, the top is running with the patch, and the bottom without.

Of course, my xterm is configured to display bold text in green, which
doesn't help matters, but I'm more concerned about the lack of any
fading at all with your patch.

-- 
see shy jo


ss.png
Description: PNG image


signature.asc
Description: Digital signature


Bug#406367: FWD: Bug#406367: [PATCH] use color instead of dim attribute for the curses driver

2007-01-10 Thread Joey Hess
This patch seems to work pretty well, submitting it for your
consideration.

- Forwarded message from Jindrich Makovicka [EMAIL PROTECTED] -

From: Jindrich Makovicka [EMAIL PROTECTED]
Date: Wed, 10 Jan 2007 18:39:46 +0100
To: [EMAIL PROTECTED]
Subject: Bug#406367: [PATCH] use color instead of dim attribute for the curses 
driver
Reply-To: Jindrich Makovicka [EMAIL PROTECTED], [EMAIL PROTECTED]
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; i486-pc-linux-gnu)

Package: aalib
Version: 1.4p5-30

Hi,

the attached patch makes the aacurses driver use black on black + bold
for the dim letters instead of the dim attribute, if the color is
available on the terminal. The reason is that A_DIM is ignored by linux
console and most of the X terminals I am aware off, and linux console
also reports that this attribute is supported, while rendering it the
same way as normal color. With this patch, all (3) levels of brightness
can be successfully utilized on the console :)

Regards,

-- 
Jindrich Makovicka

--- aacurses.c.orig 2001-04-26 16:37:31.0 +0200
+++ aacurses.c  2007-01-06 15:50:14.0 +0100
@@ -36,8 +36,14 @@
 dest-supported=AA_NORMAL_MASK;
 #ifdef HAVE_TERMATTRS
 a = termattrs();
-if (a  A_DIM)
+if (has_colors()) {
+   start_color();
+   init_pair(1, COLOR_BLACK, COLOR_BLACK);
dest-supported |= AA_DIM_MASK;
+} else {
+   if (a  A_DIM)
+   dest-supported |= AA_DIM_MASK;
+}
 if (a  A_BOLD)
dest-supported |= AA_BOLD_MASK;
 if (a  A_BOLD)
@@ -86,7 +92,12 @@
attrset(A_NORMAL);
break;
 case AA_DIM:
-   attrset(A_DIM);
+   if (has_colors()) {
+   attrset(A_BOLD);
+   attron(COLOR_PAIR(1));
+   } else {
+   attrset(A_DIM);
+   }
break;
 case AA_BOLD:
attrset(A_BOLD);


- End forwarded message -
-- 
see shy jo


signature.asc
Description: Digital signature


Bug#406367: [PATCH] use color instead of dim attribute for the curses driver

2007-01-10 Thread Jindrich Makovicka
Package: aalib
Version: 1.4p5-30

Hi,

the attached patch makes the aacurses driver use black on black + bold
for the dim letters instead of the dim attribute, if the color is
available on the terminal. The reason is that A_DIM is ignored by linux
console and most of the X terminals I am aware off, and linux console
also reports that this attribute is supported, while rendering it the
same way as normal color. With this patch, all (3) levels of brightness
can be successfully utilized on the console :)

Regards,
-- 
Jindrich Makovicka
--- aacurses.c.orig	2001-04-26 16:37:31.0 +0200
+++ aacurses.c	2007-01-06 15:50:14.0 +0100
@@ -36,8 +36,14 @@
 dest-supported=AA_NORMAL_MASK;
 #ifdef HAVE_TERMATTRS
 a = termattrs();
-if (a  A_DIM)
+if (has_colors()) {
+	start_color();
+	init_pair(1, COLOR_BLACK, COLOR_BLACK);
 	dest-supported |= AA_DIM_MASK;
+} else {
+	if (a  A_DIM)
+	dest-supported |= AA_DIM_MASK;
+}
 if (a  A_BOLD)
 	dest-supported |= AA_BOLD_MASK;
 if (a  A_BOLD)
@@ -86,7 +92,12 @@
 	attrset(A_NORMAL);
 	break;
 case AA_DIM:
-	attrset(A_DIM);
+	if (has_colors()) {
+	attrset(A_BOLD);
+	attron(COLOR_PAIR(1));
+	} else {
+	attrset(A_DIM);
+	}
 	break;
 case AA_BOLD:
 	attrset(A_BOLD);