<div dir="ltr"><div>Hi Victor,<br><br></div>How do we configure server mouse with VDAgent running? <br><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,<br></div><div class="gmail_extra">Dmitry<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 4, 2016 at 6:30 AM, Victor Toso <span dir="ltr"><<a href="mailto:lists@victortoso.com" target="_blank">lists@victortoso.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
On Wed, Aug 03, 2016 at 06:45:29PM +0300, Sameeh Jubran wrote:<br>
> This patch adds new ioctl operation to Vdagent in order to update<br>
> the driver on Vdagent state. This allows the driver to know<br>
> when Vdagent is running and when it is off.<br>
><br>
> Spice supports two mouse modes: server and client. The server mouse<br>
> mode pointer should be enabled when vdagent is off and the client<br>
> mouse mode should be enabled when it is on. The mouse mode<br>
> is updated by the driver and thus this patch is needed.<br>
<br>
</span>Just to be sure. I can still have mouse in server mode when VDAgent is<br>
running?<br>
<span class="HOEnZb"><font color="#888888"><br>
toso<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> Signed-off-by: Sameeh Jubran <<a href="mailto:sameeh@daynix.com">sameeh@daynix.com</a>><br>
> ---<br>
> vdagent/desktop_layout.cpp | 21 +++++++++++++++++++++<br>
> vdagent/desktop_layout.h | 1 +<br>
> vdagent/display_configuration.<wbr>cpp | 16 ++++++++++++++++<br>
> vdagent/display_configuration.<wbr>h | 3 ++-<br>
> 4 files changed, 40 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp<br>
> index 9c3e873..4d183e1 100644<br>
> --- a/vdagent/desktop_layout.cpp<br>
> +++ b/vdagent/desktop_layout.cpp<br>
> @@ -45,6 +45,7 @@ DesktopLayout::DesktopLayout()<br>
><br>
> DesktopLayout::~DesktopLayout(<wbr>)<br>
> {<br>
> + set_vdagent_running_for_<wbr>displays(false);<br>
> clean_displays();<br>
> delete _display_config;<br>
> }<br>
> @@ -121,6 +122,8 @@ void DesktopLayout::set_displays()<br>
> DWORD display_id = 0;<br>
> int dev_sets = 0;<br>
><br>
> + set_vdagent_running_for_<wbr>displays(true);<br>
> +<br>
> lock();<br>
> if (!consistent_displays()) {<br>
> unlock();<br>
> @@ -275,6 +278,22 @@ bool DesktopLayout::get_qxl_device_<wbr>id(WCHAR* device_key, DWORD* device_id)<br>
> return key_found;<br>
> }<br>
><br>
> +void DesktopLayout::set_vdagent_<wbr>running_for_displays(bool running)<br>
> +{<br>
> + DISPLAY_DEVICE dev_info;<br>
> + DWORD dev_id = 0;<br>
> + lock();<br>
> + ZeroMemory(&dev_info, sizeof(dev_info));<br>
> + dev_info.cb = sizeof(dev_info);<br>
> + while (EnumDisplayDevices(NULL, dev_id, &dev_info, 0)) {<br>
> + dev_id++;<br>
> + if (!(dev_info.StateFlags & DISPLAY_DEVICE_MIRRORING_<wbr>DRIVER) && wcsstr(dev_info.DeviceString, L"QXL")) {<br>
> + _display_config->set_vdagent_<wbr>running(dev_info.DeviceName, running);<br>
> + }<br>
> + }<br>
> + unlock();<br>
> +}<br>
> +<br>
> bool DesktopLayout::init_dev_mode(<wbr>LPCTSTR dev_name, DEVMODE* dev_mode, DisplayMode* mode)<br>
> {<br>
> ZeroMemory(dev_mode, sizeof(DEVMODE));<br>
> @@ -298,6 +317,8 @@ bool DesktopLayout::init_dev_mode(<wbr>LPCTSTR dev_name, DEVMODE* dev_mode, DisplayMo<br>
> // update current DisplayMode (so mouse scaling works properly)<br>
> mode->_width = dev_mode->dmPelsWidth;<br>
> mode->_height = dev_mode->dmPelsHeight;<br>
> +<br>
> + set_vdagent_running_for_<wbr>displays(true);<br>
> return true;<br>
><br>
> }<br>
> diff --git a/vdagent/desktop_layout.h b/vdagent/desktop_layout.h<br>
> index fd6af76..da5a40b 100644<br>
> --- a/vdagent/desktop_layout.h<br>
> +++ b/vdagent/desktop_layout.h<br>
> @@ -83,6 +83,7 @@ private:<br>
> static bool consistent_displays();<br>
> static bool is_attached(LPCTSTR dev_name);<br>
> static bool get_qxl_device_id(WCHAR* device_key, DWORD* device_id);<br>
> + void set_vdagent_running_for_<wbr>displays(bool enable_pointer);<br>
> private:<br>
> mutex_t _mutex;<br>
> Displays _displays;<br>
> diff --git a/vdagent/display_<wbr>configuration.cpp b/vdagent/display_<wbr>configuration.cpp<br>
> index 4565b15..7e617b6 100755<br>
> --- a/vdagent/display_<wbr>configuration.cpp<br>
> +++ b/vdagent/display_<wbr>configuration.cpp<br>
> @@ -248,6 +248,16 @@ struct WDDMMonitorConfigEscape {<br>
> QXLHead _head;<br>
> };<br>
><br>
> +struct WDDMVDAgentRunningEscape {<br>
> + WDDMVDAgentRunningEscape(bool running)<br>
> + {<br>
> + _ioctl = QXL_ESCAPE_VDAGENT_RUNNING;<br>
> + _vdagent_state.running = running;<br>
> + }<br>
> + int _ioctl;<br>
> + QXLEscapeVDAgentRunning _vdagent_state;<br>
> +};<br>
> +<br>
> DisplayConfig* DisplayConfig::create_config()<br>
> {<br>
> DisplayConfig* new_interface;<br>
> @@ -690,6 +700,12 @@ bool WDDMInterface::escape(LPCTSTR device_name, void* data, UINT size_data)<br>
> return NT_SUCCESS(status);<br>
> }<br>
><br>
> +bool WDDMInterface::set_vdagent_<wbr>running(LPCTSTR device_name, bool running)<br>
> +{<br>
> + WDDMVDAgentRunningEscape wddm_escape(running);<br>
> + return escape(device_name, &wddm_escape, sizeof(wddm_escape));<br>
> +}<br>
> +<br>
> CCD::CCD()<br>
> :_NumPathElements(0)<br>
> ,_NumModeElements(0)<br>
> diff --git a/vdagent/display_<wbr>configuration.h b/vdagent/display_<wbr>configuration.h<br>
> index b3d0198..e8ba2f0 100755<br>
> --- a/vdagent/display_<wbr>configuration.h<br>
> +++ b/vdagent/display_<wbr>configuration.h<br>
> @@ -107,7 +107,7 @@ public:<br>
> virtual bool update_dev_mode_position(<wbr>LPCTSTR dev_name, DEVMODE* dev_mode, LONG x, LONG y) = 0;<br>
> void set_monitors_config(bool flag) { _send_monitors_config = flag; }<br>
> virtual void update_config_path() {};<br>
> -<br>
> + virtual bool set_vdagent_running(LPCTSTR device_name, bool running) { return false; };<br>
> protected:<br>
> bool _send_monitors_config;<br>
> };<br>
> @@ -162,6 +162,7 @@ private:<br>
><br>
> void close_adapter(D3D_HANDLE handle);<br>
> bool escape(LPCTSTR device_name, void* data, UINT sizeData);<br>
> + bool set_vdagent_running(LPCTSTR device_name, bool running);<br>
><br>
> //GDI Function pointers<br>
> PFND3DKMT_OPENADAPTERFROMHDC _pfnOpen_adapter_hdc;<br>
> --<br>
> 2.5.5<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> ______________________________<wbr>_________________<br>
> Spice-devel mailing list<br>
> <a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.<wbr>org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/spice-devel</a><br>
______________________________<wbr>_________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.<wbr>org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/spice-devel</a><br>
</div></div></blockquote></div><br></div></div>