Re: [PATCH v2] Remove global "allowed" variable

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

 



On Thu, 2016-06-02 at 10:50 -0500, Jonathon Jongsma wrote:
> This variable was always the same value as
> dispatcher_allows_client_mouse.
> ---
> Alternate proposal.
> 
> Within reds_update_client_mouse_allowed(), it's not obvious how
> reds->dispatcher_allows_client is relevant, so move the check inside
> reds_set_client_mouse_allowed() instead.

By the way, since this is the only place that reds_set_client_mouse_allowed() is
called, I debated simply removing this static function altogether and moving the
code to the calling location. Preference?

> 
>  server/reds.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 827ba2a..5e25d21 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -1858,6 +1858,9 @@ static void reds_handle_main_link(RedsState *reds,
> RedLinkInfo *link)
>  
>  static void reds_set_client_mouse_allowed(RedsState *reds, int
> is_client_mouse_allowed, int x_res, int y_res)
>  {
> +    if (!(is_client_mouse_allowed || is_client_mouse_allowed != reds-
> >dispatcher_allows_client_mouse))
> +        return;
> +
>      reds->monitor_mode.x_res = x_res;
>      reds->monitor_mode.y_res = y_res;
>      reds->dispatcher_allows_client_mouse = is_client_mouse_allowed;
> @@ -4193,7 +4196,6 @@ void reds_core_timer_remove(RedsState *reds,
>  
>  void reds_update_client_mouse_allowed(RedsState *reds)
>  {
> -    static int allowed = FALSE;
>      int allow_now = FALSE;
>      int x_res = 0;
>      int y_res = 0;
> @@ -4211,10 +4213,7 @@ void reds_update_client_mouse_allowed(RedsState *reds)
>          }
>      }
>  
> -    if (allow_now || allow_now != allowed) {
> -        allowed = allow_now;
> -        reds_set_client_mouse_allowed(reds, allowed, x_res, y_res);
> -    }
> +    reds_set_client_mouse_allowed(reds, allow_now, x_res, y_res);
>  }
>  
>  static gboolean reds_use_client_monitors_config(RedsState *reds)
_______________________________________________
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]