All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qemu+spice] expose server mouse status
@ 2012-03-26 12:47 Alon Levy
  2012-03-26 12:47 ` [Qemu-devel] [PATCH] server: export spice_server_is_server_mouse predicate Alon Levy
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-26 12:47 UTC (permalink / raw)
  To: spice-devel, qemu-devel; +Cc: kraxel

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.2
  mouse-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(-)

-- 
1.7.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH] server: export spice_server_is_server_mouse predicate
  2012-03-26 12:47 [Qemu-devel] [PATCH qemu+spice] expose server mouse status Alon Levy
@ 2012-03-26 12:47 ` Alon Levy
  2012-03-26 12:47 ` [Qemu-devel] [PATCH] spice_info: add mouse_mode Alon Levy
  2012-03-26 12:58 ` [Qemu-devel] [Spice-devel] [PATCH qemu+spice] expose server mouse status Arnon Gilboa
  2 siblings, 0 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-26 12:47 UTC (permalink / raw)
  To: spice-devel, qemu-devel; +Cc: kraxel

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(-)

diff --git a/server/reds.c b/server/reds.c
index 27e7ea2..bf26864 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -4006,6 +4006,12 @@ SPICE_GNUC_VISIBLE int spice_server_get_peer_info(SpiceServer *s, struct sockadd
     return 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);
diff --git a/server/spice-server.syms b/server/spice-server.syms
index 4b842a3..99a7271 100644
--- a/server/spice-server.syms
+++ b/server/spice-server.syms
@@ -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;
diff --git a/server/spice.h b/server/spice.h
index 8dd1c3d..77aec92 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -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
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH] spice_info: add mouse_mode
  2012-03-26 12:47 [Qemu-devel] [PATCH qemu+spice] expose server mouse status Alon Levy
  2012-03-26 12:47 ` [Qemu-devel] [PATCH] server: export spice_server_is_server_mouse predicate Alon Levy
@ 2012-03-26 12:47 ` Alon Levy
  2012-03-26 13:06   ` Gerd Hoffmann
  2012-03-26 14:15   ` [Qemu-devel] [PATCH v2] " Alon Levy
  2012-03-26 12:58 ` [Qemu-devel] [Spice-devel] [PATCH qemu+spice] expose server mouse status Arnon Gilboa
  2 siblings, 2 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-26 12:47 UTC (permalink / raw)
  To: spice-devel, qemu-devel; +Cc: kraxel

Add 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.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hmp.c            |    2 ++
 qapi-schema.json |    7 ++++++-
 ui/spice-core.c  |    5 +++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/hmp.c b/hmp.c
index 9cf2d13..c1224fb 100644
--- a/hmp.c
+++ b/hmp.c
@@ -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");
diff --git a/qapi-schema.json b/qapi-schema.json
index 0d11d6e..72c0080 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -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
diff --git a/ui/spice-core.c b/ui/spice-core.c
index a468524..0155dba 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -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();
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [Spice-devel] [PATCH qemu+spice] expose server mouse status
  2012-03-26 12:47 [Qemu-devel] [PATCH qemu+spice] expose server mouse status Alon Levy
  2012-03-26 12:47 ` [Qemu-devel] [PATCH] server: export spice_server_is_server_mouse predicate Alon Levy
  2012-03-26 12:47 ` [Qemu-devel] [PATCH] spice_info: add mouse_mode Alon Levy
@ 2012-03-26 12:58 ` Arnon Gilboa
  2 siblings, 0 replies; 17+ messages in thread
From: Arnon Gilboa @ 2012-03-26 12:58 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel, spice-devel

ACK series
Acked-by: Arnon Gilboa <agilboa@redhat.com>

Alon Levy wrote:
> 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.2
>   mouse-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(-)
>
>   

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
  2012-03-26 12:47 ` [Qemu-devel] [PATCH] spice_info: add mouse_mode Alon Levy
@ 2012-03-26 13:06   ` Gerd Hoffmann
  2012-03-26 13:30     ` Alon Levy
  2012-03-26 13:36     ` Alon Levy
  2012-03-26 14:15   ` [Qemu-devel] [PATCH v2] " Alon Levy
  1 sibling, 2 replies; 17+ messages in thread
From: Gerd Hoffmann @ 2012-03-26 13:06 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel, spice-devel

> +#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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
  2012-03-26 13:06   ` Gerd Hoffmann
@ 2012-03-26 13:30     ` Alon Levy
  2012-03-26 13:46       ` Gerd Hoffmann
  2012-03-26 13:36     ` Alon Levy
  1 sibling, 1 reply; 17+ messages in thread
From: Alon Levy @ 2012-03-26 13:30 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel, spice-devel

On Mon, Mar 26, 2012 at 03:06:22PM +0200, Gerd Hoffmann wrote:
> > +#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.

> 
> cheers,
>   Gerd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
  2012-03-26 13:06   ` Gerd Hoffmann
  2012-03-26 13:30     ` Alon Levy
@ 2012-03-26 13:36     ` Alon Levy
  1 sibling, 0 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-26 13:36 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel, spice-devel

On Mon, Mar 26, 2012 at 03:06:22PM +0200, Gerd Hoffmann wrote:
> > +#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.

> cheers,
>   Gerd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode
  2012-03-26 13:30     ` Alon Levy
@ 2012-03-26 13:46       ` Gerd Hoffmann
  0 siblings, 0 replies; 17+ messages in thread
From: Gerd Hoffmann @ 2012-03-26 13:46 UTC (permalink / raw)
  To: spice-devel, qemu-devel

On 03/26/12 15:30, Alon Levy wrote:
> On Mon, Mar 26, 2012 at 03:06:22PM +0200, Gerd Hoffmann wrote:
>>> +#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.

> 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.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
  2012-03-26 12:47 ` [Qemu-devel] [PATCH] spice_info: add mouse_mode Alon Levy
  2012-03-26 13:06   ` Gerd Hoffmann
@ 2012-03-26 14:15   ` Alon Levy
  2012-03-29  9:08     ` Gerd Hoffmann
                       ` (2 more replies)
  1 sibling, 3 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-26 14:15 UTC (permalink / raw)
  To: qemu-devel, kraxel

Add 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.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
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(-)

diff --git a/hmp.c b/hmp.c
index 9cf2d13..8837dd0 100644
--- a/hmp.c
+++ b/hmp.c
@@ -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");
diff --git a/qapi-schema.json b/qapi-schema.json
index 0d11d6e..72c0080 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -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
diff --git a/ui/spice-core.c b/ui/spice-core.c
index a468524..1579187 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -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();
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
  2012-03-26 14:15   ` [Qemu-devel] [PATCH v2] " Alon Levy
@ 2012-03-29  9:08     ` Gerd Hoffmann
  2012-03-29 20:16       ` Alon Levy
  2012-03-29 20:19     ` Anthony Liguori
  2012-03-29 21:23     ` [Qemu-devel] [PATCH v3] " Alon Levy
  2 siblings, 1 reply; 17+ messages in thread
From: Gerd Hoffmann @ 2012-03-29  9:08 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel

On 03/26/12 16:15, Alon Levy wrote:
> Add 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.

Looks good.  What is the status of the spice-server patch?  Committed?

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
  2012-03-29  9:08     ` Gerd Hoffmann
@ 2012-03-29 20:16       ` Alon Levy
  0 siblings, 0 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-29 20:16 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

On Thu, Mar 29, 2012 at 11:08:20AM +0200, Gerd Hoffmann wrote:
> On 03/26/12 16:15, Alon Levy wrote:
> > Add 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.
> 
> Looks good.  What is the status of the spice-server patch?  Committed?

Yes.

> 
> cheers,
>   Gerd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
  2012-03-26 14:15   ` [Qemu-devel] [PATCH v2] " Alon Levy
  2012-03-29  9:08     ` Gerd Hoffmann
@ 2012-03-29 20:19     ` Anthony Liguori
  2012-03-29 20:54       ` Alon Levy
  2012-03-29 21:23     ` [Qemu-devel] [PATCH v3] " Alon Levy
  2 siblings, 1 reply; 17+ messages in thread
From: Anthony Liguori @ 2012-03-29 20:19 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel, kraxel

On 03/26/2012 09:15 AM, Alon Levy wrote:
> Add 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.
>
> Signed-off-by: Alon Levy<alevy@redhat.com>
> ---
> 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(-)
>
> diff --git a/hmp.c b/hmp.c
> index 9cf2d13..8837dd0 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -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");
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 0d11d6e..72c0080 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v2] spice_info: add mouse_mode
  2012-03-29 20:19     ` Anthony Liguori
@ 2012-03-29 20:54       ` Alon Levy
  0 siblings, 0 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-29 20:54 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel, kraxel

On Thu, Mar 29, 2012 at 03:19:16PM -0500, Anthony Liguori wrote:
> On 03/26/2012 09:15 AM, Alon Levy wrote:
> >Add 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.
> >
> >Signed-off-by: Alon Levy<alevy@redhat.com>
> >---
> >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(-)
> >
> >diff --git a/hmp.c b/hmp.c
> >index 9cf2d13..8837dd0 100644
> >--- a/hmp.c
> >+++ b/hmp.c
> >@@ -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");
> >diff --git a/qapi-schema.json b/qapi-schema.json
> >index 0d11d6e..72c0080 100644
> >--- a/qapi-schema.json
> >+++ b/qapi-schema.json
> >@@ -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.

OK. Can't imagine any trouble in using an enum.

> 
> Regards,
> 
> Anthony Liguori

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v3] spice_info: add mouse_mode
  2012-03-26 14:15   ` [Qemu-devel] [PATCH v2] " Alon Levy
  2012-03-29  9:08     ` Gerd Hoffmann
  2012-03-29 20:19     ` Anthony Liguori
@ 2012-03-29 21:23     ` Alon Levy
  2012-03-30  8:12       ` Gerd Hoffmann
  2 siblings, 1 reply; 17+ messages in thread
From: Alon Levy @ 2012-03-29 21:23 UTC (permalink / raw)
  To: qemu-devel, kraxel, anthony

Add 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.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hmp.c            |    2 ++
 qapi-schema.json |   27 ++++++++++++++++++++++++++-
 ui/spice-core.c  |    7 +++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/hmp.c b/hmp.c
index 9cf2d13..71505db 100644
--- a/hmp.c
+++ b/hmp.c
@@ -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");
diff --git a/qapi-schema.json b/qapi-schema.json
index 0d11d6e..d972499 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -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
diff --git a/ui/spice-core.c b/ui/spice-core.c
index a468524..4fc48f8 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -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();
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v3] spice_info: add mouse_mode
  2012-03-29 21:23     ` [Qemu-devel] [PATCH v3] " Alon Levy
@ 2012-03-30  8:12       ` Gerd Hoffmann
  2012-03-30 19:25         ` Alon Levy
  2012-04-01 12:06         ` Alon Levy
  0 siblings, 2 replies; 17+ messages in thread
From: Gerd Hoffmann @ 2012-03-30  8:12 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel, anthony

  Hi,

> +# @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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v3] spice_info: add mouse_mode
  2012-03-30  8:12       ` Gerd Hoffmann
@ 2012-03-30 19:25         ` Alon Levy
  2012-04-01 12:06         ` Alon Levy
  1 sibling, 0 replies; 17+ messages in thread
From: Alon Levy @ 2012-03-30 19:25 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel, anthony

On Fri, Mar 30, 2012 at 10:12:56AM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> > +# @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.

> 
> cheers,
>   Gerd
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v3] spice_info: add mouse_mode
  2012-03-30  8:12       ` Gerd Hoffmann
  2012-03-30 19:25         ` Alon Levy
@ 2012-04-01 12:06         ` Alon Levy
  1 sibling, 0 replies; 17+ messages in thread
From: Alon Levy @ 2012-04-01 12:06 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel, anthony

On Fri, Mar 30, 2012 at 10:12:56AM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> > +# @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.

> 
> cheers,
>   Gerd
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2012-04-01 12:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-26 12:47 [Qemu-devel] [PATCH qemu+spice] expose server mouse status Alon Levy
2012-03-26 12:47 ` [Qemu-devel] [PATCH] server: export spice_server_is_server_mouse predicate Alon Levy
2012-03-26 12:47 ` [Qemu-devel] [PATCH] spice_info: add mouse_mode Alon Levy
2012-03-26 13:06   ` Gerd Hoffmann
2012-03-26 13:30     ` Alon Levy
2012-03-26 13:46       ` Gerd Hoffmann
2012-03-26 13:36     ` Alon Levy
2012-03-26 14:15   ` [Qemu-devel] [PATCH v2] " Alon Levy
2012-03-29  9:08     ` Gerd Hoffmann
2012-03-29 20:16       ` Alon Levy
2012-03-29 20:19     ` Anthony Liguori
2012-03-29 20:54       ` Alon Levy
2012-03-29 21:23     ` [Qemu-devel] [PATCH v3] " Alon Levy
2012-03-30  8:12       ` Gerd Hoffmann
2012-03-30 19:25         ` Alon Levy
2012-04-01 12:06         ` Alon Levy
2012-03-26 12:58 ` [Qemu-devel] [Spice-devel] [PATCH qemu+spice] expose server mouse status Arnon Gilboa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.