Commit c21bbcfa3ff4f6dc49fb01080ef598851aa424dd

Authored by balrog
1 parent 38334f76

Reintroduce TEXT_CONSOLE_FIXED_SIZE and TEXT_CONSOLE for resizable vc's.

This partially reverts r4812 to fix an issue highlighted by Ryan Harper
with all vc's being fixed size which prevented backends with resizable
window (curses) from displaying okay.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5309 c046a42c-6fe2-441c-8c8c-71466251a162
console.c
... ... @@ -109,7 +109,8 @@ static int qemu_fifo_read(QEMUFIFO *f, uint8_t *buf, int len1)
109 109  
110 110 typedef enum {
111 111 GRAPHIC_CONSOLE,
112   - TEXT_CONSOLE
  112 + TEXT_CONSOLE,
  113 + TEXT_CONSOLE_FIXED_SIZE
113 114 } console_type_t;
114 115  
115 116 /* ??? This is mis-named.
... ... @@ -1046,7 +1047,7 @@ void console_select(unsigned int index)
1046 1047 s = consoles[index];
1047 1048 if (s) {
1048 1049 active_console = s;
1049   - if (s->g_width && s->g_height
  1050 + if (s->console_type != TEXT_CONSOLE && s->g_width && s->g_height
1050 1051 && (s->g_width != s->ds->width || s->g_height != s->ds->height))
1051 1052 dpy_resize(s->ds, s->g_width, s->g_height);
1052 1053 vga_hw_invalidate();
... ... @@ -1157,6 +1158,15 @@ static void text_console_invalidate(void *opaque)
1157 1158 {
1158 1159 TextConsole *s = (TextConsole *) opaque;
1159 1160  
  1161 + if (s->g_width != s->ds->width || s->g_height != s->ds->height) {
  1162 + if (s->console_type == TEXT_CONSOLE_FIXED_SIZE)
  1163 + dpy_resize(s->ds, s->g_width, s->g_height);
  1164 + else {
  1165 + s->g_width = s->ds->width;
  1166 + s->g_height = s->ds->height;
  1167 + text_console_resize(s);
  1168 + }
  1169 + }
1160 1170 console_refresh(s);
1161 1171 }
1162 1172  
... ... @@ -1242,6 +1252,11 @@ int is_graphic_console(void)
1242 1252 return active_console && active_console->console_type == GRAPHIC_CONSOLE;
1243 1253 }
1244 1254  
  1255 +int is_fixedsize_console(void)
  1256 +{
  1257 + return active_console && active_console->console_type != TEXT_CONSOLE;
  1258 +}
  1259 +
1245 1260 void console_color_init(DisplayState *ds)
1246 1261 {
1247 1262 int i, j;
... ... @@ -1264,14 +1279,11 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p)
1264 1279 chr = qemu_mallocz(sizeof(CharDriverState));
1265 1280 if (!chr)
1266 1281 return NULL;
1267   - s = new_console(ds, TEXT_CONSOLE);
  1282 + s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);
1268 1283 if (!s) {
1269 1284 free(chr);
1270 1285 return NULL;
1271 1286 }
1272   - if (!p)
1273   - p = DEFAULT_MONITOR_SIZE;
1274   -
1275 1287 chr->opaque = s;
1276 1288 chr->chr_write = console_puts;
1277 1289 chr->chr_send_event = console_send_event;
... ... @@ -1345,7 +1357,8 @@ void qemu_console_resize(QEMUConsole *console, int width, int height)
1345 1357 }
1346 1358  
1347 1359 void qemu_console_copy(QEMUConsole *console, int src_x, int src_y,
1348   - int dst_x, int dst_y, int w, int h) {
  1360 + int dst_x, int dst_y, int w, int h)
  1361 +{
1349 1362 if (active_console == console) {
1350 1363 if (console->ds->dpy_copy)
1351 1364 console->ds->dpy_copy(console->ds,
... ...
console.h
... ... @@ -136,6 +136,7 @@ void vga_hw_screen_dump(const char *filename);
136 136 void vga_hw_text_update(console_ch_t *chardata);
137 137  
138 138 int is_graphic_console(void);
  139 +int is_fixedsize_console(void);
139 140 CharDriverState *text_console_init(DisplayState *ds, const char *p);
140 141 void console_select(unsigned int index);
141 142 void console_color_init(DisplayState *ds);
... ...
curses.c
... ... @@ -60,7 +60,7 @@ static void curses_update(DisplayState *ds, int x, int y, int w, int h)
60 60  
61 61 static void curses_calc_pad(void)
62 62 {
63   - if (is_graphic_console()) {
  63 + if (is_fixedsize_console()) {
64 64 width = gwidth;
65 65 height = gheight;
66 66 } else {
... ...