[Spice-commits] 3 commits - vdagent/vdagent.cpp

Arnon Gilboa agilboa at kemper.freedesktop.org
Thu May 9 04:10:04 PDT 2013


 vdagent/vdagent.cpp |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

New commits:
commit b72b943309089a0c9340969f4c5bbea2e1500236
Author: Arnon Gilboa <agilboa at redhat.com>
Date:   Wed May 8 17:55:40 2013 +0300

    vdagent: drop clipboard received after timeout
    
    rhbz #951618

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 68b311e..75291b0 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -984,9 +984,12 @@ void VDAgent::on_clipboard_request(UINT format)
         event_dispatcher(VD_CLIPBOARD_TIMEOUT_MS, 0);
     }
 
-    cleanup_in_msg();
     if (_clipboard_tick) {
         vd_printf("Clipboard wait timeout");
+        _clipboard_tick = 0;
+    } else {
+        // reset incoming message state only upon completion (even after timeout)
+        cleanup_in_msg();
     }
 }
 
@@ -1308,11 +1311,15 @@ void VDAgent::handle_chunk(VDIChunk* chunk)
         memcpy((uint8_t*)_in_msg + _in_msg_pos, chunk->data, chunk->hdr.size);
         _in_msg_pos += chunk->hdr.size;
         // update clipboard tick on each clipboard chunk for timeout setting
-        if (_in_msg->type == VD_AGENT_CLIPBOARD) {
+        if (_in_msg->type == VD_AGENT_CLIPBOARD && _clipboard_tick) {
             _clipboard_tick = GetTickCount();
         }
         if (_in_msg_pos == sizeof(VDAgentMessage) + _in_msg->size) {
-            dispatch_message(_in_msg, 0);
+            if (_in_msg->type == VD_AGENT_CLIPBOARD && !_clipboard_tick) {
+                vd_printf("Clipboard received but dropped due to timeout");
+            } else {
+                dispatch_message(_in_msg, 0);
+            }
             cleanup_in_msg();
         }
     }
commit e55103589a62460a1128625740ec8c9126adeb64
Author: Arnon Gilboa <agilboa at redhat.com>
Date:   Sun May 5 15:58:15 2013 +0300

    vdagent: add support for VD_AGENT_CLIENT_DISCONNECTED
    
    vdagent is stopped, so a new instance is to be launched by vdservice.
    imho, this seems simpler than cleaning agent in/out msg state and
    reseting the vio-serial device to cleanup pending msgs.
    
    rhbz #956133

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 4d9287e..68b311e 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -1231,6 +1231,10 @@ void VDAgent::dispatch_message(VDAgentMessage* msg, uint32_t port)
     case VD_AGENT_ANNOUNCE_CAPABILITIES:
         res = a->handle_announce_capabilities((VDAgentAnnounceCapabilities*)msg->data, msg->size);
         break;
+    case VD_AGENT_CLIENT_DISCONNECTED:
+        vd_printf("Client disconnected, agent to be restarted");
+        a->set_control_event(CONTROL_STOP);
+        break;
     default:
         vd_printf("Unsupported message type %u size %u", msg->type, msg->size);
     }
commit 877ee81f813ccaeb5a75bd58f933b769ba137f84
Author: Arnon Gilboa <agilboa at redhat.com>
Date:   Thu Apr 25 13:20:37 2013 +0300

    vdagent: support sparse monitors config
    
    rhbz #953973

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index e84fb07..4d9287e 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -627,6 +627,11 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port
         VDAgentMonConfig* mon = &mon_config->monitors[i];
         vd_printf("%d. %u*%u*%u (%d,%d) %u", i, mon->width, mon->height, mon->depth, mon->x,
                   mon->y, !!(mon_config->flags & VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS));
+        if (mon->height == 0 && mon->depth == 0) {
+            vd_printf("%d. detaching", i);
+            mode->set_attached(false);
+            continue;
+        }
         mode->set_res(mon->width, mon->height, mon->depth);
         if (mon_config->flags & VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS) {
             mode->set_pos(mon->x, mon->y);
@@ -787,6 +792,7 @@ bool VDAgent::send_announce_capabilities(bool request)
     VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_REPLY);
     VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_DISPLAY_CONFIG);
     VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND);
+    VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG);
     vd_printf("Sending capabilities:");
     for (uint32_t i = 0 ; i < caps_size; ++i) {
         vd_printf("%X", caps->caps[i]);


More information about the Spice-commits mailing list