[Spice-devel] [spice-server] indicate client mouse mode to guest as capability

Yuri Benditovich yuri.benditovich at daynix.com
Mon Dec 19 09:12:59 UTC 2016


From: Yuri Benditovich <Yuri Benditovich yuri.benditovich at daynix.com>

Raise indication of capabilities array yo guest also on changing
mouse mode; add 'client mouse' capability when active.

Signed-off-by: Yuri Benditovich <Yuri Benditovich yuri.benditovich at daynix.com>
---
 server/red-worker.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/server/red-worker.c b/server/red-worker.c
index 9fd565f..0623b0f
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -403,6 +403,7 @@ static void guest_set_client_capabilities(RedWorker *worker)
         (red_channel_get_n_clients(RED_CHANNEL(worker->display_channel)) == 0)) {
         red_qxl_set_client_capabilities(worker->qxl, FALSE, caps);
     } else {
+        RedsState *reds;
         // Take least common denominator
         for (i = 0 ; i < SPICE_N_ELEMENTS(caps_available); ++i) {
             SET_CAP(caps, caps_available[i]);
@@ -413,6 +414,10 @@ static void guest_set_client_capabilities(RedWorker *worker)
                     CLEAR_CAP(caps, caps_available[i]);
             }
         }
+        reds = red_qxl_get_server(worker->qxl->st);
+        if (reds && reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) {
+            SET_CAP(caps, SPICE_DISPLAY_CAP_CLIENT_MOUSE);
+        }
         red_qxl_set_client_capabilities(worker->qxl, TRUE, caps);
     }
 }
@@ -911,6 +916,8 @@ static void handle_dev_set_mouse_mode(void *opaque, void *payload)
     RedWorkerMessageSetMouseMode *msg = payload;
     RedWorker *worker = opaque;
 
+    guest_set_client_capabilities(worker);
+
     spice_info("mouse mode %u", msg->mode);
     cursor_channel_set_mouse_mode(worker->cursor_channel, msg->mode);
 }
-- 
2.7.4



More information about the Spice-devel mailing list