[Spice-devel] [win-vd-agent PATCH v2] Check for set-monitors-position capability from client.

Sandy Stutsman sstutsma at redhat.com
Tue Aug 4 16:16:34 PDT 2015


If the client hasn't been updated to handle multi-monitor configurations
that are not multi-hat, vd_agent won't issue the MONITORS_CONFIG driver
escape.

These changes will insure that the new MONITORS_CONFIG escape in commit:
6023630562fd129433aef1eaddcf6fbee3f03e50 will not break with an older
client.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248196
---
Changed from v1:  Fixed some nits.
---
 vdagent/desktop_layout.cpp | 4 ++++
 vdagent/desktop_layout.h   | 3 ++-
 vdagent/vdagent.cpp        | 4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index 7a34f7f..a7666ca 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -35,6 +35,7 @@ void DisplayMode::set_res(DWORD width, DWORD height, DWORD depth)
 DesktopLayout::DesktopLayout()
     : _total_width (0)
     , _total_height (0)
+    , _send_monitors_position(false)
 {
     MUTEX_INIT(_mutex);
     get_displays();
@@ -365,6 +366,9 @@ bool DesktopLayout::update_monitor_config(LPCTSTR dev_name, DisplayMode* mode)
     if (!mode || !mode->get_attached())
         return false;
 
+    //Don't configure monitors unless the client supports it
+    if(!_send_monitors_position) return FALSE;
+
     HDC hdc = CreateDC(dev_name, NULL, NULL, NULL);
 
     memset(&monitor_config, 0, sizeof(monitor_config));
diff --git a/vdagent/desktop_layout.h b/vdagent/desktop_layout.h
index 0e310e3..173279f 100644
--- a/vdagent/desktop_layout.h
+++ b/vdagent/desktop_layout.h
@@ -73,7 +73,7 @@ public:
     size_t get_display_count() { return _displays.size();}
     DWORD get_total_width() { return _total_width;}
     DWORD get_total_height() { return _total_height;}
-
+    void set_position_configurable(bool flag) { _send_monitors_position = flag; }
 private:
     void clean_displays();
     void normalize_displays_pos();
@@ -89,6 +89,7 @@ private:
     Displays _displays;
     DWORD _total_width;
     DWORD _total_height;
+    bool _send_monitors_position;
 };
 
 #endif
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index efce981..c976665 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -835,6 +835,10 @@ bool VDAgent::handle_announce_capabilities(VDAgentAnnounceCapabilities* announce
         _client_caps_size = caps_size;
     }
     memcpy(_client_caps, announce_capabilities->caps, sizeof(_client_caps[0]) * caps_size);
+
+    if (VD_AGENT_HAS_CAPABILITY(_client_caps, _client_caps_size,
+                                VD_AGENT_CAP_MONITORS_CONFIG_POSITION))
+        _desktop_layout->set_position_configurable(true);
     if (announce_capabilities->request) {
         return send_announce_capabilities(false);
     }
-- 
1.9.5.msysgit.0


More information about the Spice-devel mailing list