* [Qemu-devel] [PATCH 0/2] console tweaks
@ 2013-04-26 11:24 Gerd Hoffmann
2013-04-26 11:24 ` [Qemu-devel] [PATCH 1/2] gtk: fix cursor unref Gerd Hoffmann
2013-04-26 11:24 ` [Qemu-devel] [PATCH 2/2] console: nicer initial screen Gerd Hoffmann
0 siblings, 2 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2013-04-26 11:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Two little console tweaks. One gtk bugfix, and one small usability
improvement.
please review,
Gerd
The following changes since commit e3351000cd682200835763caca87adf708ed1c65:
Makefile: Use QEMU_FLAGS for DTC compilation (2013-04-26 02:48:10 +0200)
are available in the git repository at:
git://git.kraxel.org/qemu pixman.v14
for you to fetch changes up to eedf9a7a762ab3307a22c00844d9ccbc6afeb252:
console: nicer initial screen (2013-04-26 11:52:22 +0200)
----------------------------------------------------------------
Gerd Hoffmann (2):
gtk: fix cursor unref
console: nicer initial screen
ui/console.c | 19 +++++++++++--------
ui/gtk.c | 2 +-
2 files changed, 12 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1/2] gtk: fix cursor unref
2013-04-26 11:24 [Qemu-devel] [PATCH 0/2] console tweaks Gerd Hoffmann
@ 2013-04-26 11:24 ` Gerd Hoffmann
2013-04-26 12:47 ` Anthony Liguori
2013-04-26 11:24 ` [Qemu-devel] [PATCH 2/2] console: nicer initial screen Gerd Hoffmann
1 sibling, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2013-04-26 11:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori, Gerd Hoffmann
Use correct unref function, cursors are not gobjects (at least in gtk2).
Fixes crash, reproducer: "qemu -vga qxl -display gtk".
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 42e3c0a..71fda24 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -359,7 +359,7 @@ static void gd_cursor_define(DisplayChangeListener *dcl,
pixbuf, c->hot_x, c->hot_y);
gdk_window_set_cursor(gtk_widget_get_window(s->drawing_area), cursor);
g_object_unref(pixbuf);
- g_object_unref(cursor);
+ gdk_cursor_unref(cursor);
}
static void gd_switch(DisplayChangeListener *dcl,
--
1.7.9.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] console: nicer initial screen
2013-04-26 11:24 [Qemu-devel] [PATCH 0/2] console tweaks Gerd Hoffmann
2013-04-26 11:24 ` [Qemu-devel] [PATCH 1/2] gtk: fix cursor unref Gerd Hoffmann
@ 2013-04-26 11:24 ` Gerd Hoffmann
1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2013-04-26 11:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori, Gerd Hoffmann
Now that we have a function to create a fancy DisplaySurface with a
message for the user, to handle non-existing graphics hardware, we
can make it more generic and use it for other things too.
This patch adds a text line to the in initial DisplaySurface, notifying
the user that the display isn't initialized yet by the guest.
You can see this in action when starting qemu with '-S'. Also when
booting ovmf in qemu (which needs a few moments to initialize itself
before it initializes the vga).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/console.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index b30853f..05f0b4a 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1300,19 +1300,18 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height, int bpp,
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,
@@ -1334,6 +1333,8 @@ void qemu_free_displaysurface(DisplaySurface *surface)
void register_displaychangelistener(DisplayChangeListener *dcl)
{
+ static const char nodev[] =
+ "This VM has no graphic display device.";
static DisplaySurface *dummy;
QemuConsole *con;
@@ -1352,7 +1353,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
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);
}
@@ -1600,6 +1601,8 @@ QemuConsole *graphic_console_init(DeviceState *dev,
const GraphicHwOps *hw_ops,
void *opaque)
{
+ static const char noinit[] =
+ "Guest has not initialized the display (yet).";
Error *local_err = NULL;
int width = 640;
int height = 480;
@@ -1616,7 +1619,7 @@ QemuConsole *graphic_console_init(DeviceState *dev,
"device", &local_err);
}
- s->surface = qemu_create_displaysurface(width, height);
+ s->surface = qemu_create_message_surface(width, height, noinit);
return s;
}
--
1.7.9.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] gtk: fix cursor unref
2013-04-26 11:24 ` [Qemu-devel] [PATCH 1/2] gtk: fix cursor unref Gerd Hoffmann
@ 2013-04-26 12:47 ` Anthony Liguori
0 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2013-04-26 12:47 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel
Gerd Hoffmann <kraxel@redhat.com> writes:
> Use correct unref function, cursors are not gobjects (at least in gtk2).
> Fixes crash, reproducer: "qemu -vga qxl -display gtk".
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Regards,
Anthony Liguori
> ---
> ui/gtk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 42e3c0a..71fda24 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -359,7 +359,7 @@ static void gd_cursor_define(DisplayChangeListener *dcl,
> pixbuf, c->hot_x, c->hot_y);
> gdk_window_set_cursor(gtk_widget_get_window(s->drawing_area), cursor);
> g_object_unref(pixbuf);
> - g_object_unref(cursor);
> + gdk_cursor_unref(cursor);
> }
>
> static void gd_switch(DisplayChangeListener *dcl,
> --
> 1.7.9.7
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-26 12:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 11:24 [Qemu-devel] [PATCH 0/2] console tweaks Gerd Hoffmann
2013-04-26 11:24 ` [Qemu-devel] [PATCH 1/2] gtk: fix cursor unref Gerd Hoffmann
2013-04-26 12:47 ` Anthony Liguori
2013-04-26 11:24 ` [Qemu-devel] [PATCH 2/2] console: nicer initial screen Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).