[Spice-devel] [PATCH spice-gtk 3/3] main: Do not request to resize when have desired size

Pavel Grunt pgrunt at redhat.com
Tue Jul 26 15:55:45 UTC 2016


Check for current size of monitors stored in display channels and avoid
sending request to resize if it matches new requested size.

Related: https://bugs.freedesktop.org/show_bug.cgi?id=94950
---
 src/channel-main.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/channel-main.c b/src/channel-main.c
index cf43649..ede3d87 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1074,7 +1074,28 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
 
     if (spice_main_agent_test_capability(channel,
                                      VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) {
+        gboolean config_changed = FALSE;
+        const SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(channel));
         monitors = SPICE_N_ELEMENTS(c->display);
+        for (i = 0; i < monitors; i++) { /* check whether the configuration has changed */
+            SpiceDisplayConfig config;
+            if (spice_session_get_display_config(session, i, &config)) {
+                if (memcmp(&config, &c->display[i], sizeof(SpiceDisplayConfig)) != 0) {
+                    config_changed = TRUE;
+                    break;
+                }
+            } else {
+                if (c->display[i].display_state == DISPLAY_ENABLED) {
+                    /* request to enable display i */
+                    config_changed = TRUE;
+                    break;
+                }
+            }
+        }
+        if (!config_changed) {
+            SPICE_DEBUG("monitor configuration has not changed");
+            return TRUE;
+        }
     } else {
         monitors = 0;
         for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) {
-- 
2.9.2



More information about the Spice-devel mailing list