From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryan Harper Subject: [PATCH 1/2] v2: Fix text console size/resize when using curses Date: Mon, 25 Aug 2008 12:29:14 -0500 Message-ID: <1219685355-27505-2-git-send-email-ryanh@us.ibm.com> References: <1219685355-27505-1-git-send-email-ryanh@us.ibm.com> Cc: Ryan Harper , Ian Kirk , carenas@sajinet.com.pe, kvm@vger.kernel.org To: qemu-devel@nongnu.org Return-path: Received: from e31.co.us.ibm.com ([32.97.110.149]:55957 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753928AbYHYR3Y (ORCPT ); Mon, 25 Aug 2008 13:29:24 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e31.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m7PHTI1S020087 for ; Mon, 25 Aug 2008 13:29:18 -0400 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7PHTHNJ207560 for ; Mon, 25 Aug 2008 11:29:17 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7PHTGel031820 for ; Mon, 25 Aug 2008 11:29:17 -0600 In-Reply-To: <1219685355-27505-1-git-send-email-ryanh@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: v2: drop initial size adjustment, not needed. 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)