Re: [PATCH v2] Move agent_mouse to RedsState struct

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

 



On Wed, 2016-02-03 at 15:07 -0600, Jonathon Jongsma wrote:
> Required adding a RedsState arg to reds_get_agent_mouse()
Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx>
> ---
>  server/inputs-channel.c |  8 ++++----
>  server/reds-private.h   |  2 ++
>  server/reds.c           | 10 +++++-----
>  server/reds.h           |  2 +-
>  4 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/server/inputs-channel.c b/server/inputs-channel.c
> index 8f5ab37..319d26c 100644
> --- a/server/inputs-channel.c
> +++ b/server/inputs-channel.c
> @@ -355,8 +355,8 @@ static int
> inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
>          if (reds_get_mouse_mode(reds) != SPICE_MOUSE_MODE_CLIENT) {
>              break;
>          }
> -        spice_assert((reds_get_agent_mouse() &&
> reds_has_vdagent(reds)) || tablet);
> -        if (!reds_get_agent_mouse() || !reds_has_vdagent(reds)) {
> +        spice_assert((reds_get_agent_mouse(reds) &&
> reds_has_vdagent(reds)) || tablet);
> +        if (!reds_get_agent_mouse(reds) || !reds_has_vdagent(reds))
> {
>              SpiceTabletInterface *sif;
>              sif = SPICE_CONTAINEROF(tablet->base.sif,
> SpiceTabletInterface, base);
>              sif->position(tablet, pos->x, pos->y,
> RED_MOUSE_STATE_TO_LOCAL(pos->buttons_state));
> @@ -379,7 +379,7 @@ static int
> inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
>              dz = 1;
>          }
>          if (reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) {
> -            if (reds_get_agent_mouse() && reds_has_vdagent(reds)) {
> +            if (reds_get_agent_mouse(reds) &&
> reds_has_vdagent(reds)) {
>                  inputs_channel->mouse_state.buttons =
>                      RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_press-
> >buttons_state) |
>                      (dz == -1 ? VD_AGENT_UBUTTON_MASK : 0) |
> @@ -401,7 +401,7 @@ static int
> inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
>      case SPICE_MSGC_INPUTS_MOUSE_RELEASE: {
>          SpiceMsgcMouseRelease *mouse_release = message;
>          if (reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) {
> -            if (reds_get_agent_mouse() && reds_has_vdagent(reds)) {
> +            if (reds_get_agent_mouse(reds) &&
> reds_has_vdagent(reds)) {
>                  inputs_channel->mouse_state.buttons =
>                      RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_release-
> >buttons_state);
>                  reds_handle_agent_mouse_event(reds, &inputs_channel-
> >mouse_state);
> diff --git a/server/reds-private.h b/server/reds-private.h
> index 389bc5b..d29febf 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -220,6 +220,8 @@ struct RedsState {
>      SpiceImageCompression image_compression;
>      spice_wan_compression_t jpeg_state;
>      spice_wan_compression_t zlib_glz_state;
> +
> +    gboolean agent_mouse;
>  };
>  
>  #endif
> diff --git a/server/reds.c b/server/reds.c
> index 87a5d6d..4f9f087 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -146,7 +146,6 @@ static SpiceCoreInterfaceInternal
> core_interface_adapter = {
>  
>  static pthread_mutex_t *lock_cs;
>  static long *lock_count;
> -int agent_mouse = TRUE;
>  int agent_copypaste = TRUE;
>  int agent_file_xfer = TRUE;
>  static bool exit_on_disconnect = FALSE;
> @@ -580,9 +579,9 @@ static void reds_set_mouse_mode(RedsState *reds,
> uint32_t mode)
>      main_channel_push_mouse_mode(reds->main_channel, reds-
> >mouse_mode, reds->is_client_mouse_allowed);
>  }
>  
> -int reds_get_agent_mouse(void)
> +gboolean reds_get_agent_mouse(RedsState *reds)
>  {
> -    return agent_mouse;
> +    return reds->agent_mouse;
>  }
>  
>  static void reds_update_mouse_mode(RedsState *reds)
> @@ -590,7 +589,7 @@ static void reds_update_mouse_mode(RedsState
> *reds)
>      int allowed = 0;
>      int qxl_count = red_dispatcher_qxl_count();
>  
> -    if ((agent_mouse && reds->vdagent) ||
> +    if ((reds->agent_mouse && reds->vdagent) ||
>          (inputs_channel_has_tablet(reds->inputs_channel) &&
> qxl_count == 1)) {
>          allowed = reds->dispatcher_allows_client_mouse;
>      }
> @@ -3428,6 +3427,7 @@ SPICE_GNUC_VISIBLE SpiceServer
> *spice_server_new(void)
>      reds->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
>      reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
>      reds->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
> +    reds->agent_mouse = TRUE;
>      return reds;
>  }
>  
> @@ -3802,7 +3802,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_playback_compression(SpiceServer *s, int
>  SPICE_GNUC_VISIBLE int spice_server_set_agent_mouse(SpiceServer *s,
> int enable)
>  {
>      spice_assert(reds == s);
> -    agent_mouse = enable;
> +    s->agent_mouse = enable;
>      reds_update_mouse_mode(reds);
>      return 0;
>  }
> diff --git a/server/reds.h b/server/reds.h
> index ae9aef4..09df5d3 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -59,7 +59,7 @@ void reds_set_client_mouse_allowed(RedsState *reds,
>  void reds_register_channel(RedsState *reds, RedChannel *channel);
>  void reds_unregister_channel(RedsState *reds, RedChannel *channel);
>  int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
> -int reds_get_agent_mouse(void); // used by inputs_channel
> +gboolean reds_get_agent_mouse(RedsState *reds); // used by
> inputs_channel
>  int reds_has_vdagent(RedsState *reds); // used by inputs channel
>  void reds_handle_agent_mouse_event(RedsState *reds, const
> VDAgentMouseState *mouse_state); // used by inputs_channel
>  
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]