[coreboot] [patch 2/5] libpayload: Fix curses subwindows

Myles Watson mylesgw at gmail.com
Thu May 15 18:25:26 CEST 2008



> -----Original Message-----
> From: coreboot-bounces+mylesgw=gmail.com at coreboot.org [mailto:coreboot-
> bounces+mylesgw=gmail.com at coreboot.org] On Behalf Of jordan.crouse at amd.com
> Sent: Tuesday, May 13, 2008 5:34 PM
> To: coreboot at coreboot.org
> Cc: Jordan Crouse
> Subject: [coreboot] [patch 2/5] libpayload: Fix curses subwindows
> 
> This fixes subwindows in curses so that they draw and refresh correctly.
> 
> Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
Acked-by: Myles Watson <mylesgw at gmail.com>

Thanks,
Myles

> Index: libpayload/curses/tinycurses.c
> ===================================================================
> --- libpayload.orig/curses/tinycurses.c	2008-05-12
16:21:46.000000000 -
> 0600
> +++ libpayload/curses/tinycurses.c	2008-05-13 13:38:19.000000000 -0600
> @@ -66,7 +66,7 @@
>  static int window_count = 1;
> 
>  // struct ldat foo;
> -static struct ldat ldat_list[3];
> +static struct ldat ldat_list[MAX_WINDOWS][SCREEN_Y];
>  static int ldat_count = 0;
> 
>  /* One item bigger than SCREEN_X to reverse place for a NUL byte. */
> @@ -306,7 +306,7 @@
>  	win->_begx = begx;
>  	// win->_yoffset = SP->_topstolen;
> 
> -	win->_line = &ldat_list[ldat_count++];
> +	win->_line = ldat_list[ldat_count++];
> 
>  	/* FIXME: Is this right? Should the window attributes be normal? */
>  	win->_color = PAIR_NUMBER(0);
> @@ -491,8 +491,8 @@
>  int werase(WINDOW *win)
>  {
>  	int x, y;
> -	for (y = 0; y < win->_maxy; y++) {
> -		for (x = 0; x < win->_maxx; x++) {
> +	for (y = 0; y <= win->_maxy; y++) {
> +		for (x = 0; x <= win->_maxx; x++) {
>  			win->_line[y].text[x].chars[0] = ' ';
>  			win->_line[y].text[x].attr = WINDOW_ATTRS(win);
>  		}
> @@ -559,8 +559,8 @@
>  	// FIXME.
>  	int x, y;
> 
> -	for (y = 0; y < win->_maxy; y++) {
> -		for (x = 0; x < win->_maxx; x++) {
> +	for (y = 0; y <= win->_maxy; y++) {
> +		for (x = 0; x <= win->_maxx; x++) {
>  			if (curses_flags & F_ENABLE_SERIAL)
>
serial_putchar(win->_line[y].text[x].chars[0]);
> 
> @@ -587,7 +587,7 @@
>  				 * but this will break wide characters!
>  				 */
>  				c |= (chtype)
(win->_line[y].text[x].chars[0] &
> 0xff);
> -				video_console_putc(y, x, c);
> +				video_console_putc(win->_begy + y,
win->_begx + x,
> c);
>  			}
>  		}
>  	}
> 
> --
> Jordan Crouse
> Systems Software Development Engineer
> Advanced Micro Devices, Inc.
> 
> 
> --
> coreboot mailing list
> coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot





More information about the coreboot mailing list