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

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

 



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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]