Mercurial > hg > xemacs-beta
diff src/redisplay-tty.c @ 5398:5256fedd50e6
issue 757 - tty device metric for num-color-cells
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2011-03-28 Jeff Sparkes <jsparkes@gmail.com>
* console-tty-impl.h (struct tty_console): Add field for number of
displayable colors.
* device-tty.c (tty_device_system_metrics): Return metrics for
num-color-cells and num-bit-planes. Tracker issue 757.
* device.c: There are two required args for device-system-metric.
* redisplay-tty.c (init_tty_for_redisplay): Retrieve number of
colors from terminal description. Default to 2 if none found.
author | Jeff Sparkes <jsparkes@gmail.com> |
---|---|
date | Mon, 28 Mar 2011 09:25:15 -0400 |
parents | 97eb4942aec8 |
children | 248176c74e6b |
line wrap: on
line diff
--- a/src/redisplay-tty.c Wed Mar 23 00:08:35 2011 +0100 +++ b/src/redisplay-tty.c Mon Mar 28 09:25:15 2011 -0400 @@ -1116,6 +1116,13 @@ if (CONSOLE_TTY_DATA (c)->width <= 0 || CONSOLE_TTY_DATA (c)->height <= 0) return TTY_SIZE_UNSPECIFIED; + CONSOLE_TTY_DATA (c)->colors = tgetnum("Co"); + if (CONSOLE_TTY_DATA (c)->colors == 0) + CONSOLE_TTY_DATA (c)->colors = tgetnum("colors"); + if (CONSOLE_TTY_DATA (c)->colors == 0) + /* There is always foreground and background. */ + CONSOLE_TTY_DATA (c)->colors = 2; + /* * Initialize cursor motion information. */