diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-07-09 01:00:19 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-07-23 16:27:32 +0200 |
commit | 2a085766f1f8b39103afb7e337da5a611436c177 (patch) | |
tree | 57ff67da81ba91d9c5061279cc0c1b50c121ae53 /src/virt-viewer-display-spice.c | |
parent | 0897382b457986d0e41ab10695eef3f20957ce2f (diff) | |
download | virt-viewer-2a085766f1f8b39103afb7e337da5a611436c177.tar.gz virt-viewer-2a085766f1f8b39103afb7e337da5a611436c177.tar.xz virt-viewer-2a085766f1f8b39103afb7e337da5a611436c177.zip |
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)
Diffstat (limited to 'src/virt-viewer-display-spice.c')
-rw-r--r-- | src/virt-viewer-display-spice.c | 20 |
1 files changed, 20 insertions, 0 deletions
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 @@ -75,9 +75,26 @@ virt_viewer_display_spice_class_init(VirtViewerDisplaySpiceClass *klass) } 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)); |