[Spice-devel] [RFC/POC PATCH spice-gtk 10/16] Use VDAgentMonitorsConfigV2 as the message for monitors_config

Lukáš Hrázký lhrazky at redhat.com
Tue Jun 5 15:30:36 UTC 2018


The version 2 of the message adds the output_id field.

Signed-off-by: Lukáš Hrázký <lhrazky at redhat.com>
---
 src/channel-main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index 72cc070..8b2c031 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1013,8 +1013,8 @@ static void agent_msg_queue_many(SpiceMainChannel *channel, int type, const void
 
 static int monitors_cmp(const void *p1, const void *p2, gpointer user_data)
 {
-    const VDAgentMonConfig *m1 = p1;
-    const VDAgentMonConfig *m2 = p2;
+    const VDAgentMonConfigV2 *m1 = p1;
+    const VDAgentMonConfigV2 *m2 = p2;
     double d1 = sqrt(m1->x * m1->x + m1->y * m1->y);
     double d2 = sqrt(m2->x * m2->x + m2->y * m2->y);
     int diff = d1 - d2;
@@ -1022,18 +1022,18 @@ static int monitors_cmp(const void *p1, const void *p2, gpointer user_data)
     return diff == 0 ? (char*)p1 - (char*)p2 : diff;
 }
 
-static void monitors_align(VDAgentMonConfig *monitors, int nmonitors)
+static void monitors_align(VDAgentMonConfigV2 *monitors, int nmonitors)
 {
     gint i, j, x = 0;
     guint32 used = 0;
-    VDAgentMonConfig *sorted_monitors;
+    VDAgentMonConfigV2 *sorted_monitors;
 
     if (nmonitors == 0)
         return;
 
     /* sort by distance from origin */
-    sorted_monitors = g_memdup(monitors, nmonitors * sizeof(VDAgentMonConfig));
-    g_qsort_with_data(sorted_monitors, nmonitors, sizeof(VDAgentMonConfig), monitors_cmp, NULL);
+    sorted_monitors = g_memdup(monitors, nmonitors * sizeof(VDAgentMonConfigV2));
+    g_qsort_with_data(sorted_monitors, nmonitors, sizeof(VDAgentMonConfigV2), monitors_cmp, NULL);
 
     /* super-KISS ltr alignment, feel free to improve */
     for (i = 0; i < nmonitors; i++) {
@@ -1044,7 +1044,7 @@ static void monitors_align(VDAgentMonConfig *monitors, int nmonitors)
             if (used & (1 << j))
                 continue;
             if (memcmp(&monitors[j], &sorted_monitors[i],
-                       sizeof(VDAgentMonConfig)) == 0)
+                       sizeof(VDAgentMonConfigV2)) == 0)
                 break;
         }
         used |= 1 << j;
@@ -1092,7 +1092,7 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
 gboolean spice_main_channel_send_monitor_config(SpiceMainChannel *channel)
 {
     SpiceMainChannelPrivate *c;
-    VDAgentMonitorsConfig *mon;
+    VDAgentMonitorsConfigV2 *mon;
     int i, j, monitors;
     size_t size;
 
@@ -1114,7 +1114,7 @@ gboolean spice_main_channel_send_monitor_config(SpiceMainChannel *channel)
         }
     }
 
-    size = sizeof(VDAgentMonitorsConfig) + sizeof(VDAgentMonConfig) * monitors;
+    size = sizeof(VDAgentMonitorsConfigV2) + sizeof(VDAgentMonConfigV2) * monitors;
     mon = g_malloc0(size);
 
     mon->num_of_monitors = monitors;
-- 
2.17.1



More information about the Spice-devel mailing list