Re: [PATCH v6 3/5] Move mouse-specific handling out of virtio_port_read_complete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good to me, 
Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Mon, Jan 23, 2017 at 02:53:53PM +0100, Michal Suchanek wrote:
> Move some mouse-specific code from the start of
> virtio_port_read_complete to a separate helper
> as is the case with other message types.
> 
> Signed-off-by: Michal Suchanek <msuchanek@xxxxxxx>
> ---
>  src/vdagentd/vdagentd.c | 43 ++++++++++++++++++++++++-------------------
>  1 file changed, 24 insertions(+), 19 deletions(-)
> 
> diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
> index 2b16ca4..785ce50 100644
> --- a/src/vdagentd/vdagentd.c
> +++ b/src/vdagentd/vdagentd.c
> @@ -118,6 +118,29 @@ static void do_client_disconnect(void)
>      }
>  }
>  
> +void do_client_mouse(struct vdagentd_uinput **uinputp, VDAgentMouseState *mouse)
> +{
> +    vdagentd_uinput_do_mouse(uinputp, mouse);
> +    if (!*uinputp) {
> +        /* Try to re-open the tablet */
> +        struct agent_data *agent_data =
> +            udscs_get_user_data(active_session_conn);
> +        if (agent_data)
> +            *uinputp = vdagentd_uinput_create(uinput_device,
> +                                              agent_data->width,
> +                                              agent_data->height,
> +                                              agent_data->screen_info,
> +                                              agent_data->screen_count,
> +                                              debug > 1,
> +                                              uinput_fake);
> +        if (!*uinputp) {
> +            syslog(LOG_CRIT, "Fatal uinput error");
> +            retval = 1;
> +            quit = 1;
> +        }
> +    }
> +}
> +
>  static void do_client_monitors(struct vdagent_virtio_port *vport, int port_nr,
>      VDAgentMessage *message_header, VDAgentMonitorsConfig *new_monitors)
>  {
> @@ -335,25 +358,7 @@ static int virtio_port_read_complete(
>      case VD_AGENT_MOUSE_STATE:
>          if (message_header->size != sizeof(VDAgentMouseState))
>              goto size_error;
> -        vdagentd_uinput_do_mouse(&uinput, (VDAgentMouseState *)data);
> -        if (!uinput) {
> -            /* Try to re-open the tablet */
> -            struct agent_data *agent_data =
> -                udscs_get_user_data(active_session_conn);
> -            if (agent_data)
> -                uinput = vdagentd_uinput_create(uinput_device,
> -                                                agent_data->width,
> -                                                agent_data->height,
> -                                                agent_data->screen_info,
> -                                                agent_data->screen_count,
> -                                                debug > 1,
> -                                                uinput_fake);
> -            if (!uinput) {
> -                syslog(LOG_CRIT, "Fatal uinput error");
> -                retval = 1;
> -                quit = 1;
> -            }
> -        }
> +        do_client_mouse(&uinput, (VDAgentMouseState *)data);
>          break;
>      case VD_AGENT_MONITORS_CONFIG:
>          if (message_header->size < sizeof(VDAgentMonitorsConfig))
> -- 
> 2.10.2
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]