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

Submitted by Yuri Benditovich on Dec. 19, 2016, 9:12 a.m.

Details

Message ID 1482138780-82368-2-git-send-email-yuri.benditovich@daynix.com
State New
Headers show
Series "introduce SPICE_DISPLAY_CAP_CLIENT_MOUSE capability" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Yuri Benditovich Dec. 19, 2016, 9:12 a.m.
From: Yuri Benditovich <Yuri Benditovich yuri.benditovich@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@daynix.com>
---
 server/red-worker.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

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);
 }