From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JOHOo-0001NW-QC for qemu-devel@nongnu.org; Sun, 10 Feb 2008 13:59:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOHOm-0001ML-2m for qemu-devel@nongnu.org; Sun, 10 Feb 2008 13:59:34 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOHOl-0001M2-QT for qemu-devel@nongnu.org; Sun, 10 Feb 2008 13:59:31 -0500 Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOHOl-0007Un-9s for qemu-devel@nongnu.org; Sun, 10 Feb 2008 13:59:31 -0500 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20080210190111.SJAY18243.mtaout01-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Sun, 10 Feb 2008 19:01:11 +0000 Received: from implementation.famille.thibault.fr ([82.21.96.230]) by aamtaout01-winn.ispmail.ntl.com with ESMTP id <20080210190147.BKIT219.aamtaout01-winn.ispmail.ntl.com@implementation.famille.thibault.fr> for ; Sun, 10 Feb 2008 19:01:47 +0000 Received: from samy by implementation.famille.thibault.fr with local (Exim 4.68) (envelope-from ) id 1JOHOf-0005LH-Jg for qemu-devel@nongnu.org; Sun, 10 Feb 2008 19:59:26 +0100 Date: Sun, 10 Feb 2008 18:59:25 +0000 From: Samuel Thibault Message-ID: <20080210185925.GJ4427@implementation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] Switch back from graphical mode to text mode Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hello, Thanks for merging the ncurses interface, that'll be very useful! However there is a small bug when switching back from graphical mode to text mode in vga.c: in graphical mode, the text screen is resized to 60x3 so as to display a message, but nothing is done to make sure that it will be reset back to e.g. 80x25 when switching back to text mode. The attached patch fixes that by recording when a message is displayed (and thus fake resize performed), and when going back to text mode, force the resize. Samuel Index: hw/vga.c =================================================================== RCS file: /sources/qemu/qemu/hw/vga.c,v retrieving revision 1.60 diff -u -p -r1.60 vga.c --- hw/vga.c 10 Feb 2008 16:33:14 -0000 1.60 +++ hw/vga.c 10 Feb 2008 18:58:17 -0000 @@ -1152,7 +1152,7 @@ static void vga_draw_text(VGAState *s, i } if (width != s->last_width || height != s->last_height || - cw != s->last_cw || cheight != s->last_ch) { + cw != s->last_cw || cheight != s->last_ch || s->message_screen) { s->last_scr_width = width * cw; s->last_scr_height = height * cheight; dpy_resize(s->ds, s->last_scr_width, s->last_scr_height); @@ -1160,6 +1160,7 @@ static void vga_draw_text(VGAState *s, i s->last_height = height; s->last_ch = cheight; s->last_cw = cw; + s->message_screen = 0; full_update = 1; } cursor_offset = ((s->cr[0x0e] << 8) | s->cr[0x0f]) - s->start_addr; @@ -1724,7 +1725,7 @@ static void vga_update_text(void *opaque } if (width != s->last_width || height != s->last_height || - cw != s->last_cw || cheight != s->last_ch) { + cw != s->last_cw || cheight != s->last_ch || s->message_screen) { s->last_scr_width = width * cw; s->last_scr_height = height * cheight; dpy_resize(s->ds, width, height); @@ -1732,6 +1733,7 @@ static void vga_update_text(void *opaque s->last_height = height; s->last_ch = cheight; s->last_cw = cw; + s->message_screen = 0; full_update = 1; } @@ -1806,6 +1808,7 @@ static void vga_update_text(void *opaque /* Display a message */ dpy_cursor(s->ds, -1, -1); dpy_resize(s->ds, 60, 3); + s->message_screen = 1; for (dst = chardata, i = 0; i < 60 * 3; i ++) console_write_ch(dst ++, ' '); Index: hw/vga_int.h =================================================================== RCS file: /sources/qemu/qemu/hw/vga_int.h,v retrieving revision 1.16 diff -u -p -r1.16 vga_int.h --- hw/vga_int.h 10 Feb 2008 16:33:14 -0000 1.16 +++ hw/vga_int.h 10 Feb 2008 18:58:17 -0000 @@ -129,6 +129,7 @@ uint32_t line_compare; \ uint32_t start_addr; \ uint32_t plane_updated; \ + int message_screen; \ uint8_t last_cw, last_ch; \ uint32_t last_width, last_height; /* in chars or pixels */ \ uint32_t last_scr_width, last_scr_height; /* in pixels */ \