[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Switch back from graphical mode to text mode
From: |
Samuel Thibault |
Subject: |
[Qemu-devel] Switch back from graphical mode to text mode |
Date: |
Sun, 10 Feb 2008 18:59:25 +0000 |
User-agent: |
Mutt/1.5.12-2006-07-14 |
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 */ \
- [Qemu-devel] Switch back from graphical mode to text mode,
Samuel Thibault <=