mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
Implement resolution switching in common console code.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4812 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
ea334207a3
commit
c60e08d9c6
20 changed files with 109 additions and 91 deletions
35
console.c
35
console.c
|
@ -28,6 +28,7 @@
|
|||
//#define DEBUG_CONSOLE
|
||||
#define DEFAULT_BACKSCROLL 512
|
||||
#define MAX_CONSOLES 12
|
||||
#define DEFAULT_MONITOR_SIZE "800x600"
|
||||
|
||||
#define QEMU_RGBA(r, g, b, a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define QEMU_RGB(r, g, b) QEMU_RGBA(r, g, b, 0xff)
|
||||
|
@ -108,8 +109,7 @@ static int qemu_fifo_read(QEMUFIFO *f, uint8_t *buf, int len1)
|
|||
|
||||
typedef enum {
|
||||
GRAPHIC_CONSOLE,
|
||||
TEXT_CONSOLE,
|
||||
TEXT_CONSOLE_FIXED_SIZE
|
||||
TEXT_CONSOLE
|
||||
} console_type_t;
|
||||
|
||||
/* ??? This is mis-named.
|
||||
|
@ -1041,6 +1041,9 @@ void console_select(unsigned int index)
|
|||
s = consoles[index];
|
||||
if (s) {
|
||||
active_console = s;
|
||||
if (s->g_width && s->g_height
|
||||
&& (s->g_width != s->ds->width || s->g_height != s->ds->height))
|
||||
dpy_resize(s->ds, s->g_width, s->g_height);
|
||||
vga_hw_invalidate();
|
||||
}
|
||||
}
|
||||
|
@ -1149,18 +1152,6 @@ static void text_console_invalidate(void *opaque)
|
|||
{
|
||||
TextConsole *s = (TextConsole *) opaque;
|
||||
|
||||
if (s->console_type != GRAPHIC_CONSOLE) {
|
||||
if (s->g_width != s->ds->width ||
|
||||
s->g_height != s->ds->height) {
|
||||
if (s->console_type == TEXT_CONSOLE_FIXED_SIZE)
|
||||
dpy_resize(s->ds, s->g_width, s->g_height);
|
||||
else {
|
||||
s->g_width = s->ds->width;
|
||||
s->g_height = s->ds->height;
|
||||
text_console_resize(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
console_refresh(s);
|
||||
}
|
||||
|
||||
|
@ -1268,11 +1259,14 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p)
|
|||
chr = qemu_mallocz(sizeof(CharDriverState));
|
||||
if (!chr)
|
||||
return NULL;
|
||||
s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);
|
||||
s = new_console(ds, TEXT_CONSOLE);
|
||||
if (!s) {
|
||||
free(chr);
|
||||
return NULL;
|
||||
}
|
||||
if (!p)
|
||||
p = DEFAULT_MONITOR_SIZE;
|
||||
|
||||
chr->opaque = s;
|
||||
chr->chr_write = console_puts;
|
||||
chr->chr_send_event = console_send_event;
|
||||
|
@ -1332,3 +1326,14 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p)
|
|||
|
||||
return chr;
|
||||
}
|
||||
|
||||
void qemu_console_resize(QEMUConsole *console, int width, int height)
|
||||
{
|
||||
if (console->g_width != width || console->g_height != height) {
|
||||
console->g_width = width;
|
||||
console->g_height = height;
|
||||
if (active_console == console) {
|
||||
dpy_resize(console->ds, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue