changeset: 5398:5256fedd50e6
parent: 5382:d363790fd936
user: Jeff Sparkes <jsparkes(a)gmail.com>
date: Mon Mar 28 09:25:15 2011 -0400
files: src/ChangeLog src/console-tty-impl.h src/device-tty.c src/device.c
src/redisplay-tty.c
description:
issue 757 - tty device metric for num-color-cells
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2011-03-28 Jeff Sparkes <jsparkes(a)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.
diff -r d363790fd936 -r 5256fedd50e6 src/ChangeLog
--- a/src/ChangeLog Wed Mar 23 00:08:35 2011 +0100
+++ b/src/ChangeLog Mon Mar 28 09:25:15 2011 -0400
@@ -1,3 +1,13 @@
+2011-03-28 Jeff Sparkes <jsparkes(a)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.
+
2011-03-20 Mats Lidell <matsl(a)xemacs.org>
* alloca.c (find_stack_direction):
diff -r d363790fd936 -r 5256fedd50e6 src/console-tty-impl.h
--- a/src/console-tty-impl.h Wed Mar 23 00:08:35 2011 +0100
+++ b/src/console-tty-impl.h Mon Mar 28 09:25:15 2011 -0400
@@ -62,6 +62,8 @@
int height;
int width;
+
+ int colors;
/* The count of frame number. */
int frame_count;
diff -r d363790fd936 -r 5256fedd50e6 src/device-tty.c
--- a/src/device-tty.c Wed Mar 23 00:08:35 2011 +0100
+++ b/src/device-tty.c Mon Mar 28 09:25:15 2011 -0400
@@ -196,6 +196,10 @@
case DM_size_device:
return Fcons (make_int (CONSOLE_TTY_DATA (con)->width),
make_int (CONSOLE_TTY_DATA (con)->height));
+ case DM_num_bit_planes:
+ return make_int (log2 (CONSOLE_TTY_DATA (con)->colors));
+ case DM_num_color_cells:
+ return make_int (CONSOLE_TTY_DATA (con)->colors);
default: /* No such device metric property for TTY devices */
return Qunbound;
}
diff -r d363790fd936 -r 5256fedd50e6 src/device.c
--- a/src/device.c Wed Mar 23 00:08:35 2011 +0100
+++ b/src/device.c Mon Mar 28 09:25:15 2011 -0400
@@ -1057,8 +1057,8 @@
return DEVICE_PRINTER_P (decode_device (device)) ? Qt : Qnil;
}
-DEFUN ("device-system-metric", Fdevice_system_metric, 1, 3, 0, /*
-Get a metric for DEVICE as provided by the system.
+DEFUN ("device-system-metric", Fdevice_system_metric, 2, 3, 0, /*
+Get DEVICE METRIC as provided by the system.
METRIC must be a symbol specifying requested metric. Note that the metrics
returned are these provided by the system internally, not read from resources,
diff -r d363790fd936 -r 5256fedd50e6 src/redisplay-tty.c
--- 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.
*/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches