[Spice-devel] [PATCH spice-server 1/6] red-qxl: Unify red_qxl_use_client_monitors_config and red_qxl_client_monitors_config

Frediano Ziglio fziglio at redhat.com
Thu Sep 7 11:40:21 UTC 2017


These 2 functions were doing the same stuff, calling
client_monitors_config callback in QXLInterface.
The only difference was that red_qxl_use_client_monitors_config
used a NULL value.
Added the check for proper version, QXLInstance before 3.3
did not have this callback.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-qxl.c | 10 ++--------
 server/red-qxl.h |  1 -
 server/reds.c    |  2 +-
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index b556428d2..54d642ad9 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -195,17 +195,11 @@ static void red_qxl_update_area(QXLState *qxl_state, uint32_t surface_id,
                             &payload);
 }
 
-gboolean red_qxl_use_client_monitors_config(QXLInstance *qxl)
-{
-    return (red_qxl_check_qxl_version(qxl, 3, 3) &&
-        qxl_get_interface(qxl)->client_monitors_config &&
-        qxl_get_interface(qxl)->client_monitors_config(qxl, NULL));
-}
-
 gboolean red_qxl_client_monitors_config(QXLInstance *qxl,
                                         VDAgentMonitorsConfig *monitors_config)
 {
-    return (qxl_get_interface(qxl)->client_monitors_config &&
+    return (red_qxl_check_qxl_version(qxl, 3, 3) &&
+        qxl_get_interface(qxl)->client_monitors_config &&
         qxl_get_interface(qxl)->client_monitors_config(qxl, monitors_config));
 }
 
diff --git a/server/red-qxl.h b/server/red-qxl.h
index f925f065b..5d57780a9 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -37,7 +37,6 @@ void red_qxl_start(QXLInstance *qxl);
 uint32_t red_qxl_get_ram_size(QXLInstance *qxl);
 void red_qxl_async_complete(QXLInstance *qxl, AsyncCommand *async_command);
 struct Dispatcher *red_qxl_get_dispatcher(QXLInstance *qxl);
-gboolean red_qxl_use_client_monitors_config(QXLInstance *qxl);
 gboolean red_qxl_client_monitors_config(QXLInstance *qxl, VDAgentMonitorsConfig *monitors_config);
 gboolean red_qxl_get_primary_active(QXLInstance *qxl);
 gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint *y_res);
diff --git a/server/reds.c b/server/reds.c
index b6ecc6c69..24ec2bdde 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -4401,7 +4401,7 @@ static gboolean reds_use_client_monitors_config(RedsState *reds)
     }
 
     FOREACH_QXL_INSTANCE(reds, qxl) {
-        if (!red_qxl_use_client_monitors_config(qxl))
+        if (!red_qxl_client_monitors_config(qxl, NULL))
             return FALSE;
     }
     return TRUE;
-- 
2.13.5



More information about the Spice-devel mailing list