[PATCH virt-viewer 1/3] Don't emit 'monitor-geometry-changed' for disabled displays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a display widget receives a new size allocation, we generally emit
a monitor-geometry-changed signal so that we can reconfigure the
displays. But if the widget for a *disabled* display is allocated,
there's no reason to send down a new configuration. We don't need to
emit this signal. This doesn't currently cause any problems, but I ran
into issues while testing some other uncommitted changes.
---
 src/virt-viewer-display-spice.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 399c207..f5e66a2 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -178,26 +178,25 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
                                         gpointer data G_GNUC_UNUSED)
 {
     GtkRequisition preferred;
-    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
-         */
-        virt_viewer_display_get_preferred_size(VIRT_VIEWER_DISPLAY(self), &preferred);
-        if (preferred.width == allocation->width
-            && preferred.height == allocation->height) {
-            return;
-        }
+
+    if (!virt_viewer_display_get_enabled(VIRT_VIEWER_DISPLAY(self)))
+        return;
+
+    /* 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
+     */
+    virt_viewer_display_get_preferred_size(VIRT_VIEWER_DISPLAY(self), &preferred);
+    if (preferred.width == allocation->width
+        && preferred.height == allocation->height) {
+        return;
     }
 
     if (self->priv->auto_resize != AUTO_RESIZE_NEVER)
-- 
2.1.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux