From 2a085766f1f8b39103afb7e337da5a611436c177 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Mon, 9 Jul 2012 01:00:19 +0200 Subject: Add a DISABLED display hint This flag will help to track whether the display has been removed/closed and whether it really has a valid display. Ready in contrast, is used to "hide" temporarily the display (when starting or redrawing the display, to avoid artifacts) --- src/virt-viewer-display-spice.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/virt-viewer-display-spice.c') diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c index 7bf9a9a..101abc5 100644 --- a/src/virt-viewer-display-spice.c +++ b/src/virt-viewer-display-spice.c @@ -74,10 +74,27 @@ virt_viewer_display_spice_class_init(VirtViewerDisplaySpiceClass *klass) g_type_class_add_private(klass, sizeof(VirtViewerDisplaySpicePrivate)); } +static void +show_hint_changed(VirtViewerDisplay *self) +{ + SpiceMainChannel *main_channel = virt_viewer_session_spice_get_main_channel( + VIRT_VIEWER_SESSION_SPICE(virt_viewer_display_get_session(self))); + guint enabled = TRUE; + guint nth; + + g_object_get(self, "nth-display", &nth, NULL); + if (virt_viewer_display_get_show_hint(self) & VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED) + enabled = FALSE; + + spice_main_set_display_enabled(main_channel, nth, enabled); +} + static void virt_viewer_display_spice_init(VirtViewerDisplaySpice *self G_GNUC_UNUSED) { self->priv = VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(self); + + g_signal_connect(self, "notify::show-hint", G_CALLBACK(show_hint_changed), NULL); } static void @@ -166,6 +183,9 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self, if (virt_viewer_display_get_auto_resize(VIRT_VIEWER_DISPLAY(self)) == FALSE) return; + if (virt_viewer_display_get_show_hint(VIRT_VIEWER_DISPLAY(self)) & VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED) + return; + if (virt_viewer_display_get_zoom(VIRT_VIEWER_DISPLAY(self))) { zoom = virt_viewer_display_get_zoom_level(VIRT_VIEWER_DISPLAY(self)); -- cgit