expose server mouse status
PATCH 1/1 expose server mouse status
Below are the combined summaries. This lets the current mouse mode the server is using be shown to qemu users:
(qemu) info spice
Server:
address: 0.0.0.0:10005
auth: none
compiled: 0.10.2mouse-mode: server
qemu:
Alon Levy (1):
spice_info: add mouse_mode
hmp.c | 2 ++ qapi-schema.json | 7 ++++++- ui/spice-core.c | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-)
spice:
Alon Levy (1):
server: export spice_server_is_server_mouse predicate
server/reds.c | 6 ++++++ server/spice-server.syms | 4 ++++ server/spice.h | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.3
PATCH 1/1 server: export spice_server_is_server_mouse predicate
To be used by qemu query-spice / info spice commands.
--- server/reds.c | 6 ++++++ server/spice-server.syms | 4 ++++ server/spice.h | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-)
server/reds.c +6 -0
@@ -4006,6 +4006,12 @@ SPICE_GNUC_VISIBLE int spice_server_get_peer_info(SpiceServer *s, struct sockaddreturn 0 ; } +SPICE_GNUC_VISIBLE int spice_server_is_server_mouse(SpiceServer *s) +{ +spice_assert (reds == s); +return reds->mouse_mode ==SPICE_MOUSE_MODE_SERVER ; +} + SPICE_GNUC_VISIBLE int spice_server_add_renderer(SpiceServer *s, const char *name) {spice_assert (reds == s);
server/spice-server.syms +4 -0
@@ -108,3 +108,7 @@ global: spice_server_set_uuid; spice_server_set_listen_socket_fd; } SPICE_SERVER_0.10.1; + +SPICE_SERVER_0.10.3 { + spice_server_is_server_mouse; +} SPICE_SERVER_0.10.2;
server/spice.h +3 -1
@@ -22,7 +22,7 @@#include <sys/socket.h> #include <spice/qxl_dev.h> -#define SPICE_SERVER_VERSION 0x000a02/* release 0.10.2 */ +#define SPICE_SERVER_VERSION 0x000a03/* release 0.10.3 */ /* interface base type */
@@ -485,6 +485,8 @@ int spice_server_set_agent_copypaste(SpiceServer *s, int enable);int spice_server_get_sock_info (SpiceServer *s,struct sockaddr *sa,socklen_t *salen);int spice_server_get_peer_info (SpiceServer *s,struct sockaddr *sa,socklen_t *salen); +int spice_server_is_server_mouse (SpiceServer *s); +/* migration interface */ #define SPICE_INTERFACE_MIGRATION "migration"#define SPICE_INTERFACE_MIGRATION_MAJOR 1
Signature · 1 line
1.7.9.3
PATCH 1/1 spice_info: add mouse_mode
In reply to Alon LevyAdd mouse_mode, either server or mouse, to qmp and hmp commands, based on spice_server_is_server_mouse added in spice-server 0.10.3.
--- hmp.c | 2 ++ qapi-schema.json | 7 ++++++- ui/spice-core.c | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-)
hmp.c +2 -0
@@ -350,6 +350,8 @@ void hmp_info_spice(Monitor *mon) }monitor_printf (mon," auth: %s\n" , info->auth);monitor_printf (mon," compiled: %s\n" , info->compiled_version); +monitor_printf (mon," mouse-mode: %s\n" , + info->has_mouse_mode ? info->mouse_mode :"unknown" );if (!info->has_channels || info->channels ==NULL ) {monitor_printf (mon,"Channels: none\n" );
qapi-schema.json +6 -1
@@ -654,6 +654,11 @@ # 'spice' uses SASL or direct TLS authentication, depending on command # line options # +# @mouse-mode: #optional current server mouse mode if spice server is new +# enough and exposes this information. +# 'client' if client side +# 'server' if server side +# # @channels: a list of @SpiceChannel for each active spice channel # # Since: 0.14.0
@@ -661,7 +666,7 @@ { 'type': 'SpiceInfo', 'data': {'enabled': 'bool', '*host': 'str', '*port': 'int', '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str', - '*channels': ['SpiceChannel']} } + '*mouse-mode': 'str', '*channels': ['SpiceChannel']} } ## # @query-spice
ui/spice-core.c +5 -0
@@ -462,6 +462,11 @@ SpiceInfo *qmp_query_spice(Error **errp) info->tls_port = tls_port; } +#if SPICE_SERVER_VERSION >=0x000a03 /* 0.10.3 */ + info->has_mouse_mode = true; + info->mouse_mode =g_strdup (spice_server_is_server_mouse (spice_server) ? +"server" :"client" ); +#endif /* for compatibility with the original command */ info->has_channels = true; info->channels =qmp_query_spice_channels ();
Signature · 1 line
1.7.9.3
ACK series
Quoted 31 lines · Alon Levy
Below are the combined summaries. This lets the current mouse mode the server is using be shown to qemu users:
(qemu) info spice
Server:address: 0.0.0.0:10005 auth: none compiled: 0.10.2mouse-mode: server
qemu:
Alon Levy (1):
spice_info: addmouse_modehmp.c | 2 ++ qapi-schema.json | 7 ++++++- ui/spice-core.c | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-)spice:
Alon Levy (1):
server: exportspice_server_is_server_mousepredicateserver/reds.c | 6 ++++++ server/spice-server.syms | 4 ++++ server/spice.h | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-)
Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
In reply to Alon Levyui/spice-core.c SpiceInfo *qmp_query_spice(Error **errp) · line 468
Quoted 4 lines
ui/spice-core.c +4
-0+#if SPICE_SERVER_VERSION >=0x000a03 /* 0.10.3 */ + info->has_mouse_mode = true; + info->mouse_mode =g_strdup (spice_server_is_server_mouse (spice_server) ? +"server" :"client" );
#else
info->mouse_mode = "unknown";#endif
cheers,
Gerd
Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
Quoted 8 lines · Gerd Hoffmann
ui/spice-core.c SpiceInfo *qmp_query_spice(Error **errp) · line 468
Quoted 4 lines
ui/spice-core.c +4
-0+#if SPICE_SERVER_VERSION >=0x000a03 /* 0.10.3 */ + info->has_mouse_mode = true; + info->mouse_mode =g_strdup (spice_server_is_server_mouse (spice_server) ? +"server" :"client" );#else info->mouse_mode = "unknown";#endif
Why? I don't set has_mouse_mode in this case, which defaults to 0 == false because of the malloc0, and then I check has_mouse_mode in the hmp command, and the qmp just won't send the field because has == false.
Quoted 3 lines
cheers,
Gerd
Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
Quoted 11 lines · Alon Levy
Quoted 8 lines · Gerd Hoffmann
ui/spice-core.c SpiceInfo *qmp_query_spice(Error **errp) · line 468
Quoted 4 lines
ui/spice-core.c +4
-0+#if SPICE_SERVER_VERSION >=0x000a03 /* 0.10.3 */ + info->has_mouse_mode = true; + info->mouse_mode =g_strdup (spice_server_is_server_mouse (spice_server) ? +"server" :"client" );#else info->mouse_mode = "unknown";#endif
Why?
has_mouse_mode looks superfluous and makes the code a bit more complicated than needed.
Quoted 3 lines
I don't set
has_mouse_modein this case, which defaults to 0 == false because of the malloc0, and then I checkhas_mouse_modein the hmp command, and the qmp just won't send the field because has == false.
Ah, ok, didn't see qmp does something different, then I'd suggest to just leave mouse_mode zero-initialized (aka NULL) when mouse mode info isn't available.
cheers,
Gerd
Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
In reply to Gerd HoffmannQuoted 9 lines · Gerd Hoffmann
ui/spice-core.c SpiceInfo *qmp_query_spice(Error **errp) · line 468
Quoted 4 lines
ui/spice-core.c +4
-0+#if SPICE_SERVER_VERSION >=0x000a03 /* 0.10.3 */ + info->has_mouse_mode = true; + info->mouse_mode =g_strdup (spice_server_is_server_mouse (spice_server) ? +"server" :"client" );#else info->mouse_mode = "unknown";#endif
ok, it's probably better to have this consistent across hmp and qmp, will resend this patch.
Quoted 2 lines
cheers,
Gerd
PATCH v2 1/1 spice_info: add mouse_mode
In reply to Alon LevyAdd mouse_mode, either server or mouse, to qmp and hmp commands, based on spice_server_is_server_mouse added in spice-server 0.10.3.
---v1->v2:
report mouse mode "unknown" for qmp too (Gerd Hoffman request)
hmp.c | 1 + qapi-schema.json | 7 ++++++- ui/spice-core.c | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-)
hmp.c +1 -0
@@ -350,6 +350,7 @@ void hmp_info_spice(Monitor *mon) }monitor_printf (mon," auth: %s\n" , info->auth);monitor_printf (mon," compiled: %s\n" , info->compiled_version); +monitor_printf (mon," mouse-mode: %s\n" , info->mouse_mode);if (!info->has_channels || info->channels ==NULL ) {monitor_printf (mon,"Channels: none\n" );
qapi-schema.json +6 -1
@@ -654,6 +654,11 @@ # 'spice' uses SASL or direct TLS authentication, depending on command # line options # +# @mouse-mode: #optional current server mouse mode if spice server is new +# enough and exposes this information. +# 'client' if client side +# 'server' if server side +# # @channels: a list of @SpiceChannel for each active spice channel # # Since: 0.14.0
@@ -661,7 +666,7 @@ { 'type': 'SpiceInfo', 'data': {'enabled': 'bool', '*host': 'str', '*port': 'int', '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str', - '*channels': ['SpiceChannel']} } + '*mouse-mode': 'str', '*channels': ['SpiceChannel']} } ## # @query-spice
ui/spice-core.c +7 -0
@@ -462,6 +462,13 @@ SpiceInfo *qmp_query_spice(Error **errp) info->tls_port = tls_port; } + info->has_mouse_mode = true; +#if SPICE_SERVER_VERSION >=0x000a03 /* 0.10.3 */ + info->mouse_mode =g_strdup (spice_server_is_server_mouse (spice_server) ? +"server" :"client" ); +#else + info->mouse_mode =g_strdup ("unknown" ); +#endif /* for compatibility with the original command */ info->has_channels = true; info->channels =qmp_query_spice_channels ();
Signature · 1 line
1.7.9.3
Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
Quoted 2 lines · Alon Levy
Add
mouse_mode, either server or mouse, to qmp and hmp commands, based onspice_server_is_server_mouseadded in spice-server 0.10.3.
Looks good. What is the status of the spice-server patch? Committed?
cheers,
Gerd
Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
Quoted 5 lines · Gerd Hoffmann
Quoted 2 lines · Alon Levy
Add
mouse_mode, either server or mouse, to qmp and hmp commands, based onspice_server_is_server_mouseadded in spice-server 0.10.3.Looks good. What is the status of the spice-server patch? Committed?
Yes.
Quoted 3 lines
cheers,
Gerd
Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
In reply to Alon LevyQuoted 30 lines · Alon Levy
Add
mouse_mode, either server or mouse, to qmp and hmp commands, based onspice_server_is_server_mouseadded in spice-server 0.10.3.Signed-off-by Alon Levy<[email protected]>---
v1->v2:
report mouse mode "unknown" for qmp too (Gerd Hoffman request)hmp.c | 1 + qapi-schema.json | 7 ++++++- ui/spice-core.c | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-)hmp.c +1
-0@@ -350,6 +350,7 @@ void hmp_info_spice(Monitor *mon) }monitor_printf (mon," auth: %s\n" , info->auth);monitor_printf (mon," compiled: %s\n" , info->compiled_version); +monitor_printf (mon," mouse-mode: %s\n" , info->mouse_mode);if (!info->has_channels || info->channels ==NULL ) {monitor_printf (mon,"Channels: none\n" );qapi-schema.json +0
-0
qapi-schema.json line 661
Quoted 8 lines
qapi-schema.json +5
-0@@ -654,6 +654,11 @@ # 'spice' uses SASL or direct TLS authentication, depending on command # line options # +# @mouse-mode: #optional current server mouse mode if spice server is new +# enough and exposes this information. +# 'client' if client side +# 'server' if server side +#
Please document which version this is being added in and use an enum instead of a string to describe the mode.
If it's trouble a boolean, then use a bool instead of an enum.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
Quoted 43 lines · Anthony Liguori
Quoted 30 lines · Alon Levy
Add
mouse_mode, either server or mouse, to qmp and hmp commands, based onspice_server_is_server_mouseadded in spice-server 0.10.3.Signed-off-by Alon Levy<[email protected]>---
v1->v2:
report mouse mode "unknown" for qmp too (Gerd Hoffman request)hmp.c | 1 + qapi-schema.json | 7 ++++++- ui/spice-core.c | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-)hmp.c +1
-0@@ -350,6 +350,7 @@ void hmp_info_spice(Monitor *mon) }monitor_printf (mon," auth: %s\n" , info->auth);monitor_printf (mon," compiled: %s\n" , info->compiled_version); +monitor_printf (mon," mouse-mode: %s\n" , info->mouse_mode);if (!info->has_channels || info->channels ==NULL ) {monitor_printf (mon,"Channels: none\n" );qapi-schema.json +0
-0qapi-schema.json line 661
Quoted 8 lines
qapi-schema.json +5
-0@@ -654,6 +654,11 @@ # 'spice' uses SASL or direct TLS authentication, depending on command # line options # +# @mouse-mode: #optional current server mouse mode if spice server is new +# enough and exposes this information. +# 'client' if client side +# 'server' if server side +#Please document which version this is being added in and use an enum instead of a string to describe the mode.
Quoted 1 line
If it's trouble a boolean, then use a bool instead of an enum.
OK. Can't imagine any trouble in using an enum.
Quoted 4 lines
Regards,
Anthony Liguori
PATCH v3 1/1 spice_info: add mouse_mode
In reply to Alon LevyAdd mouse_mode, either server or mouse, to qmp and hmp commands, based on spice_server_is_server_mouse added in spice-server 0.10.3.
--- hmp.c | 2 ++ qapi-schema.json | 27 ++++++++++++++++++++++++++- ui/spice-core.c | 7 +++++++ 3 files changed, 35 insertions(+), 1 deletion(-)
hmp.c +2 -0
@@ -350,6 +350,8 @@ void hmp_info_spice(Monitor *mon) }monitor_printf (mon," auth: %s\n" , info->auth);monitor_printf (mon," compiled: %s\n" , info->compiled_version); +monitor_printf (mon," mouse-mode: %s\n" , + SpiceQueryMouseMode_lookup[info->mouse_mode]);if (!info->has_channels || info->channels ==NULL ) {monitor_printf (mon,"Channels: none\n" );
qapi-schema.json +26 -1
@@ -634,6 +634,25 @@ 'tls': 'bool'} } ## +# @SpiceQueryMouseMode +# +# An enumation of Spice mouse states. +# +# @client: Mouse cursor position is determined by the client. +# +# @server: Mouse cursor position is determined by the server. +# +# @unknown: No information is available about mouse mode used by +# the spice server. +# +# Note: spice/enums.h has a SpiceMouseMode already, hence the name. +# +# Since: 1.1 +## +{ 'enum': 'SpiceQueryMouseMode', + 'data': [ 'client', 'server', 'unknown' ] } + +## # @SpiceInfo # # Information about the SPICE session.
@@ -654,6 +673,12 @@ # 'spice' uses SASL or direct TLS authentication, depending on command # line options # +# @mouse-mode: The mode in which the mouse cursor is displayed currently. Can +# be determined by the client or the server, or unknown if spice +# server doesn't provide this information. +# +# Since: 1.1 +# # @channels: a list of @SpiceChannel for each active spice channel # # Since: 0.14.0
@@ -661,7 +686,7 @@ { 'type': 'SpiceInfo', 'data': {'enabled': 'bool', '*host': 'str', '*port': 'int', '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str', - '*channels': ['SpiceChannel']} } + 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']} } ## # @query-spice
ui/spice-core.c +7 -0
@@ -462,6 +462,13 @@ SpiceInfo *qmp_query_spice(Error **errp) info->tls_port = tls_port; } +#if SPICE_SERVER_VERSION >=0x000a03 /* 0.10.3 */ + info->mouse_mode =spice_server_is_server_mouse (spice_server) ? +SPICE_QUERY_MOUSE_MODE_SERVER : +SPICE_QUERY_MOUSE_MODE_CLIENT ; +#else + info->mouse_mode =SPICE_QUERY_MOUSE_MODE_UNKNOWN ; +#endif /* for compatibility with the original command */ info->has_channels = true; info->channels =qmp_query_spice_channels ();
Signature · 1 line
1.7.9.3
Re: [Qemu-devel] [PATCH v3] spice_info: add mouse_mode
Hi,
qapi-schema.json line 648
Quoted 12 lines
qapi-schema.json +12
-0+# @SpiceQueryMouseMode +# +# An enumation of Spice mouse states. +# +# @client: Mouse cursor position is determined by the client. +# +# @server: Mouse cursor position is determined by the server. +# +# @unknown: No information is available about mouse mode used by +# the spice server. +# +# Note: spice/enums.h has a SpiceMouseMode already, hence the name.
I guess it makes sense then to just add "unknown" to the existing SpiceMouseMode and reuse it ...
cheers,
Gerd
Re: [Qemu-devel] [PATCH v3] spice_info: add mouse_mode
Quoted 17 lines · Gerd Hoffmann
Hi,
qapi-schema.json line 648
Quoted 12 lines
qapi-schema.json +12
-0+# @SpiceQueryMouseMode +# +# An enumation of Spice mouse states. +# +# @client: Mouse cursor position is determined by the client. +# +# @server: Mouse cursor position is determined by the server. +# +# @unknown: No information is available about mouse mode used by +# the spice server. +# +# Note: spice/enums.h has a SpiceMouseMode already, hence the name.I guess it makes sense then to just add "unknown" to the existing SpiceMouseMode and reuse it ...
But then you don't get the nifty autogenerated lookup table, although I agree having two enums is bound to cause confusion somehow. I could just code a lookup table for the hmp.
Quoted 4 lines
cheers,
Gerd
Re: [Qemu-devel] [PATCH v3] spice_info: add mouse_mode
In reply to Gerd HoffmannQuoted 17 lines · Gerd Hoffmann
Hi,
qapi-schema.json line 648
Quoted 12 lines
qapi-schema.json +12
-0+# @SpiceQueryMouseMode +# +# An enumation of Spice mouse states. +# +# @client: Mouse cursor position is determined by the client. +# +# @server: Mouse cursor position is determined by the server. +# +# @unknown: No information is available about mouse mode used by +# the spice server. +# +# Note: spice/enums.h has a SpiceMouseMode already, hence the name.I guess it makes sense then to just add "unknown" to the existing SpiceMouseMode and reuse it ...
hmm, actually that would require adding #include "spice/enums.h" to qapi-types.h, not sure that would be accepted happily - making qapi-types depend on spice.h must be controlled with an ifdef since spice can be disabled, and that means the schema would be different depending on the configuration options - I know we specifically don't change command line options based on configure flags, just the results of using them.
Quoted 4 lines
cheers,
Gerd