summaryrefslogtreecommitdiff
path: root/console/display.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-08-29 23:57:44 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-08-29 23:57:44 +0000
commitf713724dc9049b3b7bb8bcc3d112747619c3fa13 (patch)
treeac6579c635ad3ffa7a4908d4bf48d34763d68dc4 /console/display.c
parentc19963fb7ad44ac4c5f908f3587e551c727c5be1 (diff)
2002-08-30 Marcus Brinkmann <marcus@gnu.org>
* display.c (display_create): Likewise. Set DISPLAY->attr.attr_def instead the color versions. (struct attr): Remove fgcol_def, bgcol_def, and add attr_def. (handle_esc_bracket_m): Set all attributes to their defaults for case 0. Set default color using default attribute for case 49 and case 39. (display_output_one): Likewise. * console.c (options): Add --attribute option. (parse_opt): Parse --attribute option. Bail out with argp_error on error. (netfs_append_args): ... (struct cons): Replace foreground and background with new attribute member. (vcons_lookup): Pass CONS->attribute to display_create instead CONS->foreground and CONS->background. (main): Set default colors and attributes. (parse_attributes): New function.
Diffstat (limited to 'console/display.c')
-rw-r--r--console/display.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/console/display.c b/console/display.c
index 908a1d06..43e01e29 100644
--- a/console/display.c
+++ b/console/display.c
@@ -125,8 +125,7 @@ typedef struct output *output_t;
struct attr
{
- unsigned int bgcol_def;
- unsigned int fgcol_def;
+ conchar_attr_t attr_def;
conchar_attr_t current;
/* True if in alternate character set (ASCII graphic) mode. */
unsigned int altchar;
@@ -978,9 +977,7 @@ handle_esc_bracket_m (attr_t attr, int code)
{
case 0:
/* All attributes off: <sgr0>. */
- memset (&attr->current, 0, sizeof (conchar_attr_t));
- attr->current.fgcol = attr->fgcol_def;
- attr->current.bgcol = attr->bgcol_def;
+ attr->current = attr->attr_def;
attr->altchar = 0;
break;
case 1:
@@ -1041,7 +1038,7 @@ handle_esc_bracket_m (attr_t attr, int code)
break;
case 39:
/* Default foreground color; ANSI?. */
- attr->current.fgcol = attr->fgcol_def;
+ attr->current.fgcol = attr->attr_def.fgcol;
break;
case 40 ... 47:
/* Set background color: <setab>. */
@@ -1049,7 +1046,7 @@ handle_esc_bracket_m (attr_t attr, int code)
break;
case 49:
/* Default background color; ANSI?. */
- attr->current.bgcol = attr->bgcol_def;
+ attr->current.bgcol = attr->attr_def.bgcol;
break;
}
}
@@ -1519,9 +1516,7 @@ display_output_one (display_t display, wchar_t chr)
break;
case L'M': /* ECMA-48 <RIS>. */
/* Reset: <rs2>. */
- * (uint32_t *) &display->attr.current = 0;
- display->attr.current.bgcol = display->attr.bgcol_def;
- display->attr.current.fgcol = display->attr.fgcol_def;
+ display->attr.current = display->attr.attr_def;
display->attr.altchar = 0;
user->cursor.status = CONS_CURSOR_NORMAL;
/* Fall through. */
@@ -1681,7 +1676,7 @@ display_init (void)
being ENCODING. */
error_t
display_create (display_t *r_display, const char *encoding,
- int foreground, int background)
+ conchar_attr_t def_attr)
{
error_t err = 0;
display_t display;
@@ -1704,10 +1699,8 @@ display_create (display_t *r_display, const char *encoding,
display->notify_port->display = display;
mutex_init (&display->lock);
- display->attr.bgcol_def = background;
- display->attr.fgcol_def = foreground;
- display->attr.current.bgcol = display->attr.bgcol_def;
- display->attr.current.fgcol = display->attr.fgcol_def;
+ display->attr.attr_def = def_attr;
+ display->attr.current = display->attr.attr_def;
err = user_create (display, width, height, lines, L' ',
display->attr.current);
if (err)