[virt-tools-list] [PATCH virt-viewer] Fix regression with enabling additional displays
Jonathon Jongsma
jjongsma at redhat.com
Fri Mar 14 20:45:21 UTC 2014
Commit 8fa942 broke enabling of additional displays. We don't want to send down
display re-configurations due to events that happen while setting up windows for
enabled displays that we recieve from the server. However, by ignoring
allocations on unmapped windows, we fail to send display configurations for new
displays that a user is attempting to enable via the window menu. To
discriminate between these two cases, we check whether the display is in the
'ready' state or not.
- Unmapped displays with the 'ready' hint set can be assumed to be displays
that are enabled on the server that we are attempting to create windows for on
the client. In this case, we should *not* send a display configuration to the
server
- Unmapped displays with the 'ready' hint cleared can be assumed to be displays
that are not yet enabled on the server that we are trying to enable in the
client. In this case, we *should* send a display configuration to the server
---
src/virt-viewer-display-spice.c | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index c44dfcb..76dfb47 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -189,22 +189,26 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
gpointer data G_GNUC_UNUSED)
{
GtkRequisition preferred;
-
- /* ignore all allocations before the widget gets mapped to screen since we
- * only want to trigger guest resizing due to user actions
- */
- if (!gtk_widget_get_mapped(GTK_WIDGET(self)))
- return;
-
- /* when the window gets resized due to a change in zoom level, we don't want
- * to re-size the guest display. So if we get an allocation event that
- * resizes the window to the size it already wants to be (based on desktop
- * size and zoom level), just return early
- */
- gtk_widget_get_preferred_size(GTK_WIDGET(self), NULL, &preferred);
- if (preferred.width == allocation->width
- && preferred.height == allocation->height) {
- return;
+ guint hint = virt_viewer_display_get_show_hint(VIRT_VIEWER_DISPLAY(self));
+
+ if (hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_READY)
+ {
+ /* ignore all allocations before the widget gets mapped to screen since we
+ * only want to trigger guest resizing due to user actions
+ */
+ if (!gtk_widget_get_mapped(GTK_WIDGET(self)))
+ return;
+
+ /* when the window gets resized due to a change in zoom level, we don't want
+ * to re-size the guest display. So if we get an allocation event that
+ * resizes the window to the size it already wants to be (based on desktop
+ * size and zoom level), just return early
+ */
+ gtk_widget_get_preferred_size(GTK_WIDGET(self), NULL, &preferred);
+ if (preferred.width == allocation->width
+ && preferred.height == allocation->height) {
+ return;
+ }
}
if (self->priv->auto_resize != AUTO_RESIZE_NEVER)
--
1.8.5.3
More information about the virt-tools-list
mailing list