> 
> From: Victor Toso <m...@victortoso.com>
> 
> As we will not be doing anything in case clipboard is already grabbed
> 
> Signed-off-by: Victor Toso <victort...@redhat.com>
> Signed-off-by: Victor Toso <m...@victortoso.com>
> ---
>  src/spice-gtk-session.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index 83eaa3e..5f052ed 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -636,6 +636,11 @@ static void clipboard_get_targets(GtkClipboard
> *clipboard,
>          }
>      }
>  
> +    if (s->clip_grabbed[selection]) {
> +        SPICE_DEBUG("Clipboard is already grabbed, ignoring %d atoms",
> n_atoms);
> +        return;
> +    }
> +
>      /* Set all Atoms that matches our current protocol implementation */
>      num_types = 0;
>      for (a = 0; a < n_atoms; a++) {
> @@ -666,14 +671,13 @@ static void clipboard_get_targets(GtkClipboard
> *clipboard,
>          return;
>      }
>  
> -    if (!s->clip_grabbed[selection]) {
> -        s->clip_grabbed[selection] = TRUE;
> +    s->clip_grabbed[selection] = TRUE;
>  
> -        if (spice_main_agent_test_capability(s->main,
> VD_AGENT_CAP_CLIPBOARD_BY_DEMAND))
> -            spice_main_clipboard_selection_grab(s->main, selection, types,
> num_types);
> -        /* Sending a grab causes the agent to do an implicit release */
> -        s->nclip_targets[selection] = 0;
> -    }
> +    if (spice_main_agent_test_capability(s->main,
> VD_AGENT_CAP_CLIPBOARD_BY_DEMAND))
> +        spice_main_clipboard_selection_grab(s->main, selection, types,
> num_types);
> +
> +    /* Sending a grab causes the agent to do an implicit release */
> +    s->nclip_targets[selection] = 0;
>  }
>  
>  static void clipboard_owner_change(GtkClipboard        *clipboard,

Acked-by: Frediano Ziglio <fzig...@redhat.com>

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

Reply via email to