From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWfYx-0002BI-J5 for qemu-devel@nongnu.org; Fri, 22 Aug 2008 18:56:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWfYv-0002Ah-UW for qemu-devel@nongnu.org; Fri, 22 Aug 2008 18:56:59 -0400 Received: from [199.232.76.173] (port=33749 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWfYv-0002Ae-PI for qemu-devel@nongnu.org; Fri, 22 Aug 2008 18:56:57 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:49173) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KWfYv-00033G-OO for qemu-devel@nongnu.org; Fri, 22 Aug 2008 18:56:58 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e34.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m7MMunm7025227 for ; Fri, 22 Aug 2008 18:56:49 -0400 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7MMunC1217250 for ; Fri, 22 Aug 2008 16:56:49 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7MMunjc020492 for ; Fri, 22 Aug 2008 16:56:49 -0600 Date: Fri, 22 Aug 2008 17:56:47 -0500 From: Ryan Harper Subject: Re: [Qemu-devel] [PATCH 1/2] Fix text console size/resize when using curses Message-ID: <20080822225647.GC17312@us.ibm.com> References: <1219428221-22947-1-git-send-email-ryanh@us.ibm.com> <1219428221-22947-2-git-send-email-ryanh@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: andrzej zaborowski Cc: Ryan Harper , qemu-devel@nongnu.org, kvm@vger.kernel.org * andrzej zaborowski [2008-08-22 17:40]: > 2008/8/22 Ryan Harper : > > The current console output is broken in curses mode size the default starting > > size might not match the launching terminal size. Change initial size to be > > based on the terminal. Also, resize events fail to ensure that both the text > > console and curses display areas are the same size; this causes broken output > > like: > > > > QEMU 0.9.1 monitor - type 'help' for more information > > (qemu) > > (qemu) > > (qemu) > > > > To fix this, ensure that the display width and the text area width are sync for > > text consoles on refresh; also force a resize event whenever we invalidate the > > text console. > > > > Signed-off-by: Ryan Harper > > > > diff --git a/console.c b/console.c > > index 1c94980..89bdc52 100644 > > --- a/console.c > > +++ b/console.c > > @@ -608,6 +608,9 @@ static void console_refresh(TextConsole *s) > > s->text_y[0] = 0; > > s->text_x[1] = s->width - 1; > > s->text_y[1] = s->height - 1; > > + /* ensure that textconsole area is the same size as the display */ > > + s->g_width = s->ds->width; > > + s->g_height = s->ds->height; > > s->cursor_invalidate = 1; > > return; > > } > > @@ -1158,6 +1161,8 @@ static void text_console_invalidate(void *opaque) > > TextConsole *s = (TextConsole *) opaque; > > > > console_refresh(s); > > + /* resize if needed */ > > + text_console_resize(s); > > } > > > > static void text_console_update(void *opaque, console_ch_t *chardata) > > diff --git a/curses.c b/curses.c > > index d09eff2..a8972f4 100644 > > --- a/curses.c > > +++ b/curses.c > > @@ -362,8 +362,8 @@ void curses_display_init(DisplayState *ds, int full_screen) > > ds->data = (void *) screen; > > ds->linesize = 0; > > ds->depth = 0; > > - ds->width = 640; > > - ds->height = 400; > > + ds->width = COLS * FONT_WIDTH; > > + ds->height = LINES * FONT_HEIGHT; > > ds->dpy_update = curses_update; > > ds->dpy_resize = curses_resize; > > ds->dpy_refresh = curses_refresh; > > @@ -371,6 +371,6 @@ void curses_display_init(DisplayState *ds, int full_screen) > > > > invalidate = 1; > > > > - /* Standard VGA initial text mode dimensions */ > > - curses_resize(ds, 80, 25); > > + /* setup up initial display size based on terminal settings */ > > + curses_resize(ds, COLS, LINES); > > These two changes in curses.c don't look ok. ds->width/height and the > curses_resize() parameters are not supposed to be the host terminal > size, they're just the default settings for the virtual display size > (same way as sdl.c sets 640x400 at start regardless of the host, and > likely the bios will force the resize anyway). The host terminal > dimensions are later taken into account in curses_calc_pad to ensure > correct display. Hrm, indeed. I had initially included that because without it the first display of the monitor wasn't correct. Pulling those changes out, that doesn't seem to be needed any more. > I can't comment on the console.c changes at the moment. I'll await comments on console.c and resend without the above two superflous changes. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com