@@ -1631,6 +1631,9 @@ static void vga_update_resolution_graphics(VGAState *s)
s->multi_run != multi_run ||
s->multi_scan != multi_scan ||
s->want_full_update) {
+ if (s->ds->surface->pf.depth == 0) {
+ goto dont_touch_display_surface;
+ }
#if defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
if (depth == 16 || depth == 32) {
#else
@@ -1647,6 +1650,7 @@ static void vga_update_resolution_graphics(VGAState *s)
} else {
qemu_console_resize(s->ds, disp_width, height);
}
+ dont_touch_display_surface:
s->last_scr_width = disp_width;
s->last_scr_height = height;
s->last_width = disp_width;
@@ -1668,7 +1672,17 @@ static void vga_update_resolution_text(VGAState *s)
cw != s->last_cw || cheight != s->last_ch || s->last_depth) {
s->last_scr_width = width * cw;
s->last_scr_height = height * cheight;
- qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height);
+ if (s->ds->surface->pf.depth != 0) {
+ qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height);
+ } else {
+ /*
+ * curses expects width and height to be in character cell
+ * dimensions, not pixels.
+ */
+ s->ds->surface->width = width;
+ s->ds->surface->height = height;
+ dpy_resize(s->ds);
+ }
s->last_depth = 0;
s->last_width = width;
s->last_height = height;