[Spice-devel] [PATCH spice-gtk 2/2] gtk: hide cursor when ungrabbed

Christophe Fergeau cfergeau at redhat.com
Mon Oct 27 02:12:28 PDT 2014


On Fri, Oct 24, 2014 at 06:34:17PM +0200, Marc-André Lureau wrote:
> Let's avoid confusion of multiple pointers visible on the client
> desktop: hide the guest pointer if the spice client doesn't have the
> grab, display it grain when the grab is taken back.

s/grain/again

ACK.

Christophe


> ---
>  gtk/spice-widget-cairo.c | 2 +-
>  gtk/spice-widget.c       | 7 ++++---
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
> index 1c7b358..05d708f 100644
> --- a/gtk/spice-widget-cairo.c
> +++ b/gtk/spice-widget-cairo.c
> @@ -118,7 +118,7 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
>  
>          if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER &&
>              d->mouse_guest_x != -1 && d->mouse_guest_y != -1 &&
> -            !d->show_cursor) {
> +            !d->show_cursor && d->mouse_grab_active) {
>              GdkPixbuf *image = d->mouse_pixbuf;
>              if (image != NULL) {
>                  gdk_cairo_set_source_pixbuf(cr, image,
> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> index 85757cb..1978d7b 100644
> --- a/gtk/spice-widget.c
> +++ b/gtk/spice-widget.c
> @@ -896,10 +896,9 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
>      } else {
>          d->mouse_grab_active = true;
>          g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, true);
> -    }
> -
> -    if (status == GDK_GRAB_SUCCESS)
>          set_mouse_accel(display, FALSE);
> +        gtk_widget_queue_draw(GTK_WIDGET(display));
> +    }
>  
>  end:
>      gdk_cursor_unref(blank);
> @@ -1018,6 +1017,8 @@ static void try_mouse_ungrab(SpiceDisplay *display)
>      gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)),
>                               screen, x, y);
>  
> +    gtk_widget_queue_draw(GTK_WIDGET(display));
> +
>      g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false);
>  }
>  
> -- 
> 1.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141027/166bb778/attachment.sig>


More information about the Spice-devel mailing list