Commit 68f00996405e899688e56249fd1e7c7810f67dbb
1 parent
428c5705
fix curses interface (Stefano Stabellini)
Hi all, this patch fixes the curses interface: when we switch from one console to another we need to change the displaystate width and height even though in the curses case the backing buffer remains of the same size. I am also putting back the call to text_console_resize in text_console_invalidate so that resizeable text consoles can be properly handled. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6389 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
15 additions
and
3 deletions
console.c
... | ... | @@ -1067,8 +1067,13 @@ void console_select(unsigned int index) |
1067 | 1067 | if (s) { |
1068 | 1068 | DisplayState *ds = s->ds; |
1069 | 1069 | active_console = s; |
1070 | - ds->surface = qemu_resize_displaysurface(ds->surface, s->g_width, | |
1071 | - s->g_height, 32, 4 * s->g_width); | |
1070 | + if (ds_get_bits_per_pixel(s->ds)) { | |
1071 | + ds->surface = qemu_resize_displaysurface(ds->surface, s->g_width, | |
1072 | + s->g_height, 32, 4 * s->g_width); | |
1073 | + } else { | |
1074 | + s->ds->surface->width = s->width; | |
1075 | + s->ds->surface->height = s->height; | |
1076 | + } | |
1072 | 1077 | dpy_resize(s->ds); |
1073 | 1078 | vga_hw_invalidate(); |
1074 | 1079 | } |
... | ... | @@ -1186,6 +1191,11 @@ void kbd_put_keysym(int keysym) |
1186 | 1191 | static void text_console_invalidate(void *opaque) |
1187 | 1192 | { |
1188 | 1193 | TextConsole *s = (TextConsole *) opaque; |
1194 | + if (!ds_get_bits_per_pixel(s->ds) && s->console_type == TEXT_CONSOLE) { | |
1195 | + s->g_width = ds_get_width(s->ds); | |
1196 | + s->g_height = ds_get_height(s->ds); | |
1197 | + text_console_resize(s); | |
1198 | + } | |
1189 | 1199 | console_refresh(s); |
1190 | 1200 | } |
1191 | 1201 | ... | ... |
curses.c
... | ... | @@ -106,6 +106,8 @@ static void curses_resize(DisplayState *ds) |
106 | 106 | gheight = ds_get_height(ds); |
107 | 107 | |
108 | 108 | curses_calc_pad(); |
109 | + ds->surface->width = width * FONT_WIDTH; | |
110 | + ds->surface->height = height * FONT_HEIGHT; | |
109 | 111 | } |
110 | 112 | |
111 | 113 | #ifndef _WIN32 |
... | ... | @@ -367,7 +369,7 @@ void curses_display_init(DisplayState *ds, int full_screen) |
367 | 369 | dcl->dpy_text_cursor = curses_cursor_position; |
368 | 370 | register_displaychangelistener(ds, dcl); |
369 | 371 | qemu_free_displaysurface(ds->surface); |
370 | - ds->surface = qemu_create_displaysurface_from(80, 25, 0, 0, (uint8_t*) screen); | |
372 | + ds->surface = qemu_create_displaysurface_from(640, 400, 0, 0, (uint8_t*) screen); | |
371 | 373 | |
372 | 374 | invalidate = 1; |
373 | 375 | ... | ... |