[virt-tools-list] [PATCH virt-viewer 14/19] Use SpiceDisplay:ready property instead of channel mark
Marc-André Lureau
marcandre.lureau at gmail.com
Mon Jul 16 16:57:49 UTC 2012
The display can now check several conditions before the display can be
shown, use that instead of display mark, which was not high-level
enough.
---
src/virt-viewer-display-spice.c | 38 +++++++++++++++-----------------------
1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 101abc5..53430dd 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -122,31 +122,25 @@ virt_viewer_display_spice_get_pixbuf(VirtViewerDisplay *display)
}
static void
-display_mark(SpiceChannel *channel G_GNUC_UNUSED,
- gint mark,
- VirtViewerDisplay *display)
+display_ready(GObject *display,
+ GParamSpec *pspec G_GNUC_UNUSED,
+ VirtViewerDisplay *self)
{
- DEBUG_LOG("Toggle monitor visibility %p %d", channel, mark);
+ guint hint;
+ gboolean ready;
- virt_viewer_display_set_show_hint(display, mark);
-}
+ g_object_get(display, "ready", &ready, NULL);
+ DEBUG_LOG("display %p ready:%d", self, ready);
-static void
-primary_create(SpiceChannel *channel G_GNUC_UNUSED,
- gint format G_GNUC_UNUSED,
- gint width,
- gint height,
- gint stride G_GNUC_UNUSED,
- gint shmid G_GNUC_UNUSED,
- gpointer imgdata G_GNUC_UNUSED,
- VirtViewerDisplay *display)
-{
- DEBUG_LOG("spice desktop resize %dx%d", width, height);
+ hint = virt_viewer_display_get_show_hint(self);
+ if (ready)
+ hint |= VIRT_VIEWER_DISPLAY_SHOW_HINT_READY;
+ else
+ hint &= ~VIRT_VIEWER_DISPLAY_SHOW_HINT_READY;
- virt_viewer_display_set_desktop_size(display, width, height);
+ virt_viewer_display_set_show_hint(self, hint);
}
-
static void
virt_viewer_display_spice_keyboard_grab(SpiceDisplay *display G_GNUC_UNUSED,
int grabbed,
@@ -239,10 +233,8 @@ virt_viewer_display_spice_new(VirtViewerSessionSpice *session,
self->priv->display = spice_display_new(s, channelid);
g_object_unref(s);
- virt_viewer_signal_connect_object(channel, "display-primary-create",
- G_CALLBACK(primary_create), self, 0);
- virt_viewer_signal_connect_object(channel, "display-mark",
- G_CALLBACK(display_mark), self, 0);
+ virt_viewer_signal_connect_object(self->priv->display, "notify::ready",
+ G_CALLBACK(display_ready), self, 0);
gtk_container_add(GTK_CONTAINER(self), g_object_ref(self->priv->display));
gtk_widget_show(GTK_WIDGET(self->priv->display));
--
1.7.10.4
More information about the virt-tools-list
mailing list