Re: [libvirt] [Patch]: spice agent-mouse support [v3]
On Fri, Mar 9, 2012 at 3:29 PM, Osier Yang jy...@redhat.com wrote: Pushed with the attached diff squashed in. You are added in the contributors list now, please let me known if you'd like another name. Thanks for the patch! It's ok. Thank you. -- Zhou Peng -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Patch]: spice agent-mouse support [v3]
On 2012年03月07日 19:57, Zhou Peng wrote: Sorry my git send-email failed to the list :-( Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn spice agent-mouse support Usage: graphics type='spice' mouse mode='client'|'server'/ graphics/ Pushed with the attached diff squashed in. You are added in the contributors list now, please let me known if you'd like another name. Thanks for the patch! Regards, Osier diff --git a/AUTHORS b/AUTHORS index 954fd1a..e4bd51d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -224,6 +224,7 @@ Patches have also been contributed by: Peter Robinson pbrobin...@gmail.com Benjamin Camaben...@dolka.fr Duncan Rance libv...@dunquino.com + Peng Zhouailvpen...@gmail.com [send patches to get your name here] diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d8ced3a..bf0675e 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2851,6 +2851,7 @@ qemu-kvm -net nic,model=? /dev/null lt;image compression='auto_glz'/gt; lt;streaming mode='filter'/gt; lt;clipboard copypaste='no'/gt; +lt;mouse mode='client'/gt; lt;/graphicsgt;/pre p Spice supports variable compression settings for audio, @@ -2888,7 +2889,7 @@ qemu-kvm -net nic,model=? /dev/null setting it's codemodecode/ attribute to one of codeserver/code or codeclient/code , span class=sincesince 0.9.11/span. If no mode is - specified, the spice default will be used (client mode). + specified, the qemu default will be used (client mode). /p /dd dtcoderdp/code/dt diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2238558..d7ec221 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -253,8 +253,6 @@ virDomainChrDefFree; virDomainChrDefNew; virDomainChrSourceDefCopy; virDomainChrSourceDefFree; -virDomainGraphicsSpiceMouseModeTypeFromString; -virDomainGraphicsSpiceMouseModeTypeToString; virDomainChrSpicevmcTypeFromString; virDomainChrSpicevmcTypeToString; virDomainChrTcpProtocolTypeFromString; @@ -347,6 +345,8 @@ virDomainGraphicsSpiceImageCompressionTypeFromString; virDomainGraphicsSpiceImageCompressionTypeToString; virDomainGraphicsSpiceJpegCompressionTypeFromString; virDomainGraphicsSpiceJpegCompressionTypeToString; +virDomainGraphicsSpiceMouseModeTypeFromString; +virDomainGraphicsSpiceMouseModeTypeToString; virDomainGraphicsSpicePlaybackCompressionTypeFromString; virDomainGraphicsSpicePlaybackCompressionTypeToString; virDomainGraphicsSpiceStreamingModeTypeFromString; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args new file mode 100644 index 000..2c3ef06 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args @@ -0,0 +1,8 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \ +/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ +-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ +-hda /dev/HostVG/QEMUGuest1 -chardev spicevmc,id=charchannel0,name=vdagent \ +-device virtserialport,bus=virtio-serial1.0,nr=3,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 \ +-usb -spice port=5903,tls-port=5904,addr=127.0.0.1,agent-mouse=off,x509-dir=/etc/pki/libvirt-spice,tls-channel=main \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml similarity index 100% rename from tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.xml rename to tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args b/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args deleted file mode 100644 index 746c116..000 --- a/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args +++ /dev/null @@ -1,9 +0,0 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \ -/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults \ --monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device \ -virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa -hda \ -/dev/HostVG/QEMUGuest1 -chardev spicevmc,id=charchannel0,name=vdagent -device \ -virtserialport,bus=virtio-serial1.0,nr=3,chardev=charchannel0,id=channel0\ -,name=com.redhat.spice.0 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\ -agent-mouse=off,x509-dir=/etc/pki/libvirt-spice,tls-channel=main -device \ -virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0abc9cf..3cfd69c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c
Re: [libvirt] [Patch]: spice agent-mouse support [v3]
Sorry my git send-email failed to the list :-( Signed-off-by: Zhou Peng zhoup...@nfs.iscas.ac.cn spice agent-mouse support Usage: graphics type='spice' mouse mode='client'|'server'/ graphics/ diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6fcca94..b63f6a0 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2809,6 +2809,13 @@ qemu-kvm -net nic,model=? /dev/null to codeno/code, span class=sincesince 0.9.3/span. /p +p + Mouse mode is set by the codemousecode/ element, + setting it's codemodecode/ attribute to one of + codeserver/code or codeclient/code , + span class=sincesince 0.9.11/span. If no mode is + specified, the spice default will be used (client mode). +/p /dd dtcoderdp/code/dt dd diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3908733..bb0df03 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1776,6 +1776,17 @@ empty/ /element /optional +optional + element name=mouse +attribute name=mode + choice +valueserver/value +valueclient/value + /choice +/attribute +empty/ + /element +/optional /interleave /group group diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f9654f1..aa31fe6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression, on, off); +VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode, + VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST, + default, + server, + client); + VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST, default, @@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, VIR_FREE(copypaste); def-data.spice.copypaste = copypasteVal; +} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) { +const char *mode = virXMLPropString(cur, mode); +int modeVal; + +if (!mode) { +virDomainReportError(VIR_ERR_XML_ERROR, %s, + _(spice mouse missing mode)); +goto error; +} + +if ((modeVal = virDomainGraphicsSpiceMouseModeTypeFromString(mode)) = 0) { +virDomainReportError(VIR_ERR_XML_ERROR, + _(unknown mouse mode value '%s'), + mode); +VIR_FREE(mode); +goto error; +} +VIR_FREE(mode); + +def-data.spice.mousemode = modeVal; } } cur = cur-next; @@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, } if (!children (def-data.spice.image || def-data.spice.jpeg || def-data.spice.zlib || def-data.spice.playback || - def-data.spice.streaming || def-data.spice.copypaste)) { + def-data.spice.streaming || def-data.spice.copypaste || + def-data.spice.mousemode)) { virBufferAddLit(buf, \n); children = 1; } @@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf, if (def-data.spice.streaming) virBufferAsprintf(buf, streaming mode='%s'/\n, virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming)); +if (def-data.spice.mousemode) +virBufferAsprintf(buf, mouse mode='%s'/\n, + virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode)); if (def-data.spice.copypaste) virBufferAsprintf(buf, clipboard copypaste='%s'/\n, virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 596be4d..a9c118a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1003,6 +1003,14 @@ enum virDomainGraphicsSpicePlaybackCompression { VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST }; +enum virDomainGraphicsSpiceMouseMode { +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0, +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER, +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT, + +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST +}; + enum
Re: [libvirt] [Patch]: spice agent-mouse support [v3]
On 2012年03月05日 16:17, Zhou Peng wrote: Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn spice agent-mouse support Usage: graphics type='spice' mouse mode='client'|'server'/ graphics/ diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6fcca94..0adf859 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null tocodeno/code,span class=sincesince 0.9.3/span. /p +p + It can be specified whether client or server mouse mode + to use for spice. The default is client which enables + passing mouse events via Spice agent. Not true from the codes, (no default value is set for mode). And think above lines can be omitted. It's duplicate with below somehow. Below is enough. + The mouse mode is set by thecodemousecode/ element, + setting it'scodemodecode/ attribute to one of +codeserver/code orcodeclient/code. Better to document since which release the element is introduced. e.g. span class=since0.9.11/span +/p /dd dtcoderdp/code/dt dd diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3908733..bb0df03 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1776,6 +1776,17 @@ empty/ /element /optional +optional +element name=mouse +attribute name=mode +choice +valueserver/value +valueclient/value +/choice +/attribute +empty/ +/element +/optional /interleave /group group diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f9654f1..b99e770 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression, on, off); +VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode, + VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST, + default, + server, + client); + VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST, default, @@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, VIR_FREE(copypaste); def-data.spice.copypaste = copypasteVal; +} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) { +const char *mode = virXMLPropString(cur, mode); +int modeVal; + +if (!mode) { +virDomainReportError(VIR_ERR_XML_ERROR, %s, + _(spice mouse missing mode)); +goto error; +} + +if ((modeVal = + virDomainGraphicsSpiceMouseModeTypeFromString(mode))= 0) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/ + _(unknown mouse mode value '%s'), mode); +VIR_FREE(mode); +goto error; +} +VIR_FREE(mode); + +def-data.spice.mousemode = modeVal; } } cur = cur-next; @@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, } if (!children (def-data.spice.image || def-data.spice.jpeg || def-data.spice.zlib || def-data.spice.playback || - def-data.spice.streaming || def-data.spice.copypaste)) { + def-data.spice.streaming || def-data.spice.copypaste || + def-data.spice.mousemode)) { virBufferAddLit(buf, \n); children = 1; } @@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf, if (def-data.spice.streaming) virBufferAsprintf(buf, streaming mode='%s'/\n, virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming)); +if (def-data.spice.mousemode) +virBufferAsprintf(buf, mouse mode='%s'/\n, + virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode)); if (def-data.spice.copypaste) virBufferAsprintf(buf, clipboard copypaste='%s'/\n, virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 596be4d..a9c118a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1003,6 +1003,14 @@ enum virDomainGraphicsSpicePlaybackCompression { VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST }; +enum virDomainGraphicsSpiceMouseMode { +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0, +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER, +
Re: [libvirt] [Patch]: spice agent-mouse support [v3]
On Tue, Mar 6, 2012 at 10:08 PM, Osier Yang jy...@redhat.com wrote: On 2012年03月05日 16:17, Zhou Peng wrote: Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn spice agent-mouse support Usage: graphics type='spice' mouse mode='client'|'server'/ graphics/ diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6fcca94..0adf859 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null tocodeno/code,span class=sincesince 0.9.3/span. /p +p + It can be specified whether client or server mouse mode + to use for spice. The default is client which enables + passing mouse events via Spice agent. Not true from the codes, (no default value is set for mode). And It's qemu spice's default. That is, if mouse mode is not specified in qemu argv. Here it's equal to graphics type='spice' element without specifying mouse mode=xx/ sub-element. And IMO passing nothing is consistent and better with qemu if no mouse sub-elem in vm-xml. think above lines can be omitted. It's duplicate with below somehow. Below is enough. + The mouse mode is set by thecodemousecode/ element, + setting it'scodemodecode/ attribute to one of +codeserver/code orcodeclient/code. Better to document since which release the element is introduced. e.g. span class=since0.9.11/span +/p /dd dtcoderdp/code/dt dd diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3908733..bb0df03 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1776,6 +1776,17 @@ empty/ /element /optional +optional +element name=mouse +attribute name=mode +choice +valueserver/value +valueclient/value +/choice +/attribute +empty/ +/element +/optional /interleave /group group diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f9654f1..b99e770 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression, on, off); +VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode, + VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST, + default, + server, + client); + VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST, default, @@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, VIR_FREE(copypaste); def-data.spice.copypaste = copypasteVal; + } else if (xmlStrEqual(cur-name, BAD_CAST mouse)) { + const char *mode = virXMLPropString(cur, mode); + int modeVal; + + if (!mode) { + virDomainReportError(VIR_ERR_XML_ERROR, %s, + _(spice mouse missing mode)); + goto error; + } + + if ((modeVal = + virDomainGraphicsSpiceMouseModeTypeFromString(mode))= 0) { + virDomainReportError(VIR_ERR_INTERNAL_ERROR, s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/ + _(unknown mouse mode value '%s'), mode); + VIR_FREE(mode); + goto error; + } + VIR_FREE(mode); + + def-data.spice.mousemode = modeVal; } } cur = cur-next; @@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, } if (!children (def-data.spice.image || def-data.spice.jpeg || def-data.spice.zlib || def-data.spice.playback || - def-data.spice.streaming || def-data.spice.copypaste)) { + def-data.spice.streaming || def-data.spice.copypaste || + def-data.spice.mousemode)) { virBufferAddLit(buf, \n); children = 1; } @@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf, if (def-data.spice.streaming) virBufferAsprintf(buf, streaming mode='%s'/\n, virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming)); + if (def-data.spice.mousemode) + virBufferAsprintf(buf, mouse mode='%s'/\n, + virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode)); if (def-data.spice.copypaste) virBufferAsprintf(buf, clipboard copypaste='%s'/\n, virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste)); diff
Re: [libvirt] [Patch]: spice agent-mouse support [v3]
On 03/07/2012 10:02 AM, Zhou Peng wrote: On Tue, Mar 6, 2012 at 10:08 PM, Osier Yangjy...@redhat.com wrote: On 2012年03月05日 16:17, Zhou Peng wrote: Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn spice agent-mouse support Usage: graphics type='spice' mouse mode='client'|'server'/ graphics/ diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6fcca94..0adf859 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null tocodeno/code,span class=sincesince 0.9.3/span. /p +p + It can be specified whether client or server mouse mode + to use for spice. The default is client which enables + passing mouse events via Spice agent. Not true from the codes, (no default value is set for mode). And It's qemu spice's default. That is, if mouse mode is not specified in qemu argv. Here it's equal tographics type='spice' element without specifyingmouse mode=xx/ sub-element. And IMO passing nothing is consistent and better with qemu if nomouse sub-elem in vm-xml. The new introduced XML will make sense for all hypervisor drivers, (Note that libvirt is a general lib for kinds of hypervisor drivers), so you should declare it's only for qemu if really wants to ducument it. E.g. snip If no rom bar is specified, the qemu default will be used (older versions of qemu used a default of off, while newer qemus have a default of on). /snip think above lines can be omitted. It's duplicate with below somehow. Below is enough. + The mouse mode is set by thecodemousecode/element, + setting it'scodemodecode/attribute to one of +codeserver/codeorcodeclient/code. Better to document since which release the element is introduced. e.g.span class=since0.9.11/span +/p /dd dtcoderdp/code/dt dd diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3908733..bb0df03 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1776,6 +1776,17 @@ empty/ /element /optional +optional +element name=mouse +attribute name=mode +choice +valueserver/value +valueclient/value +/choice +/attribute +empty/ +/element +/optional /interleave /group group diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f9654f1..b99e770 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression, on, off); +VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode, + VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST, + default, + server, + client); + VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST, default, @@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, VIR_FREE(copypaste); def-data.spice.copypaste = copypasteVal; +} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) { +const char *mode = virXMLPropString(cur, mode); +int modeVal; + +if (!mode) { +virDomainReportError(VIR_ERR_XML_ERROR, %s, + _(spice mouse missing mode)); +goto error; +} + +if ((modeVal = + virDomainGraphicsSpiceMouseModeTypeFromString(mode))= 0) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/ + _(unknown mouse mode value '%s'), mode); +VIR_FREE(mode); +goto error; +} +VIR_FREE(mode); + +def-data.spice.mousemode = modeVal; } } cur = cur-next; @@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, } if (!children(def-data.spice.image || def-data.spice.jpeg || def-data.spice.zlib || def-data.spice.playback || - def-data.spice.streaming || def-data.spice.copypaste)) { + def-data.spice.streaming || def-data.spice.copypaste || + def-data.spice.mousemode)) { virBufferAddLit(buf, \n); children = 1; } @@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf, if (def-data.spice.streaming) virBufferAsprintf(buf, streaming mode='%s'/\n, virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming)); +if
[libvirt] [Patch]: spice agent-mouse support [v3]
Signed-off-by: Zhou Peng zhoup...@nfs.iscas.ac.cn spice agent-mouse support Usage: graphics type='spice' mouse mode='client'|'server'/ graphics/ diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6fcca94..0adf859 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null to codeno/code, span class=sincesince 0.9.3/span. /p +p + It can be specified whether client or server mouse mode + to use for spice. The default is client which enables + passing mouse events via Spice agent. + The mouse mode is set by the codemousecode/ element, + setting it's codemodecode/ attribute to one of + codeserver/code or codeclient/code. +/p /dd dtcoderdp/code/dt dd diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3908733..bb0df03 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1776,6 +1776,17 @@ empty/ /element /optional +optional + element name=mouse +attribute name=mode + choice +valueserver/value +valueclient/value + /choice +/attribute +empty/ + /element +/optional /interleave /group group diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f9654f1..b99e770 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression, on, off); +VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode, + VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST, + default, + server, + client); + VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST, default, @@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, VIR_FREE(copypaste); def-data.spice.copypaste = copypasteVal; +} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) { +const char *mode = virXMLPropString(cur, mode); +int modeVal; + +if (!mode) { +virDomainReportError(VIR_ERR_XML_ERROR, %s, + _(spice mouse missing mode)); +goto error; +} + +if ((modeVal = + virDomainGraphicsSpiceMouseModeTypeFromString(mode)) = 0) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _(unknown mouse mode value '%s'), mode); +VIR_FREE(mode); +goto error; +} +VIR_FREE(mode); + +def-data.spice.mousemode = modeVal; } } cur = cur-next; @@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, } if (!children (def-data.spice.image || def-data.spice.jpeg || def-data.spice.zlib || def-data.spice.playback || - def-data.spice.streaming || def-data.spice.copypaste)) { + def-data.spice.streaming || def-data.spice.copypaste || + def-data.spice.mousemode)) { virBufferAddLit(buf, \n); children = 1; } @@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf, if (def-data.spice.streaming) virBufferAsprintf(buf, streaming mode='%s'/\n, virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming)); +if (def-data.spice.mousemode) +virBufferAsprintf(buf, mouse mode='%s'/\n, + virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode)); if (def-data.spice.copypaste) virBufferAsprintf(buf, clipboard copypaste='%s'/\n, virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 596be4d..a9c118a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1003,6 +1003,14 @@ enum virDomainGraphicsSpicePlaybackCompression { VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST }; +enum virDomainGraphicsSpiceMouseMode { +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0, +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER, +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT, + +VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST +}; + enum virDomainGraphicsSpiceStreamingMode {