qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Switch back from graphical mode to text mode
@ 2008-02-10 18:59 Samuel Thibault
  2008-02-11  0:13 ` andrzej zaborowski
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Thibault @ 2008-02-10 18:59 UTC (permalink / raw)
  To: qemu-devel

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 */           \

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Switch back from graphical mode to text mode
  2008-02-10 18:59 [Qemu-devel] Switch back from graphical mode to text mode Samuel Thibault
@ 2008-02-11  0:13 ` andrzej zaborowski
  0 siblings, 0 replies; 2+ messages in thread
From: andrzej zaborowski @ 2008-02-11  0:13 UTC (permalink / raw)
  To: qemu-devel

Hi,

On 10/02/2008, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> 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.

Oops, right.  I committed a slightly different fix from that in your
patch, so that the size change is automatically noticed instead of
having to be forced.

Thanks for the patch though and for the report.
-- 
Please do not print this email unless absolutely necessary. Spread
environmental awareness.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-11  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-10 18:59 [Qemu-devel] Switch back from graphical mode to text mode Samuel Thibault
2008-02-11  0:13 ` andrzej zaborowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).