[Spice-devel] [PATCH] spice_info: add mouse_mode

Gerd Hoffmann kraxel at redhat.com
Mon Mar 26 06:46:27 PDT 2012


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



More information about the Spice-devel mailing list