return surface;
}
-static DisplaySurface *qemu_create_dummy_surface(void)
+static DisplaySurface *qemu_create_message_surface(int w, int h,
+ const char *msg)
{
- static const char msg[] =
- "This VM has no graphic display device.";
- DisplaySurface *surface = qemu_create_displaysurface(640, 480);
+ DisplaySurface *surface = qemu_create_displaysurface(w, h);
pixman_color_t bg = color_table_rgb[0][COLOR_BLACK];
pixman_color_t fg = color_table_rgb[0][COLOR_WHITE];
pixman_image_t *glyph;
int len, x, y, i;
len = strlen(msg);
- x = (640/FONT_WIDTH - len) / 2;
- y = (480/FONT_HEIGHT - 1) / 2;
+ x = (w / FONT_WIDTH - len) / 2;
+ y = (h / FONT_HEIGHT - 1) / 2;
for (i = 0; i < len; i++) {
glyph = qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont16, msg[i]);
qemu_pixman_glyph_render(glyph, surface->image, &fg, &bg,
void register_displaychangelistener(DisplayChangeListener *dcl)
{
+ static const char nodev[] =
+ "This VM has no graphic display device.";
static DisplaySurface *dummy;
QemuConsole *con;
dcl->ops->dpy_gfx_switch(dcl, con->surface);
} else {
if (!dummy) {
- dummy = qemu_create_dummy_surface();
+ dummy = qemu_create_message_surface(640, 480, nodev);
}
dcl->ops->dpy_gfx_switch(dcl, dummy);
}
const GraphicHwOps *hw_ops,
void *opaque)
{
+ static const char noinit[] =
+ "Guest has not initialized the display (yet).";
int width = 640;
int height = 480;
QemuConsole *s;
&error_abort);
}
- s->surface = qemu_create_displaysurface(width, height);
+ s->surface = qemu_create_message_surface(width, height, noinit);
return s;
}