From: Ian Jackson Date: Tue, 10 Mar 2009 18:10:20 +0000 (+0000) Subject: fix console switch X-Git-Tag: xen-3.4.0-rc2~66^2~6 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cd0754c87ab87a3705acc6dc68b0da0cfce35a43;p=qemu-xen-3.4-testing.git fix console switch Import some console switch improvements and fixes from qemu mainstream. Signed-off-by: Stefano Stabellini This includes relevant parts of: af3a9031061251fbbee2c1f06b876c3732cfee71 git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3068 c046a42c-6fe2-441c-8c8c-71466251a162 New features for QEMU text console, by Stefan Weil. a528b80cb09977806129249ea604aaef3830f3ec git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3489 c046a42c-6fe2-441c-8c8c-71466251a162 Miscellaneous VNC related fixes from Xen forwarded by Matthew Kent. --- diff --git a/console.c b/console.c index 01913280..9a099fb7 100644 --- a/console.c +++ b/console.c @@ -1190,7 +1190,7 @@ static TextConsole *new_console(DisplayState *ds, console_type_t console_type) } else { /* HACK: Put graphical consoles before text consoles. */ for (i = nb_consoles; i > 0; i--) { - if (!consoles[i - 1]->console_type == GRAPHIC_CONSOLE) + if (consoles[i - 1]->console_type == GRAPHIC_CONSOLE) break; consoles[i] = consoles[i - 1]; } @@ -1258,6 +1258,8 @@ static char *text_console_strs[128]; static void text_console_do_init(CharDriverState *chr, DisplayState *ds, const char *p) { TextConsole *s; + unsigned width; + unsigned height; static int color_inited; s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE); @@ -1277,15 +1279,36 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, const c if (!color_inited) { color_inited = 1; - console_color_init(ds); + console_color_init(s->ds); } s->y_displayed = 0; s->y_base = 0; s->total_height = DEFAULT_BACKSCROLL; s->x = 0; s->y = 0; - s->g_width = ds_get_width(s->ds); - s->g_height = ds_get_height(s->ds); + width = ds_get_width(s->ds); + height = ds_get_height(s->ds); + if (p != 0) { + width = strtoul(p, (char **)&p, 10); + if (*p == 'C') { + p++; + width *= FONT_WIDTH; + } + if (*p == 'x') { + p++; + height = strtoul(p, (char **)&p, 10); + if (*p == 'C') { + p++; + height *= FONT_HEIGHT; + } + } + } + s->g_width = width; + s->g_height = height; + + s->hw_invalidate = text_console_invalidate; + s->hw_text_update = text_console_update; + s->hw = s; /* Set text attribute defaults */ s->t_attrib_default.bold = 0;