On 06/03/2016 09:16 AM, Pavel Grunt wrote: > The returned value from do_pointer_grab() is treated as a boolean - grab > was successful or not. Change the function to return a boolean value. > > Reported-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx> > --- > src/spice-widget.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/src/spice-widget.c b/src/spice-widget.c > index d0fa912..0c70ce4 100644 > --- a/src/spice-widget.c > +++ b/src/spice-widget.c > @@ -930,12 +930,13 @@ error: > } > #endif > > -static GdkGrabStatus do_pointer_grab(SpiceDisplay *display) > +static gboolean do_pointer_grab(SpiceDisplay *display) > { > SpiceDisplayPrivate *d = display->priv; > GdkWindow *window = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display))); > - GdkGrabStatus status = GDK_GRAB_FAILED; > + GdkGrabStatus status; > GdkCursor *blank = get_blank_cursor(); > + gboolean grab_successful = FALSE; > > if (!gtk_widget_get_realized(GTK_WIDGET(display))) > goto end; > @@ -964,7 +965,8 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display) > NULL, > blank, > GDK_CURRENT_TIME); > - if (status != GDK_GRAB_SUCCESS) { > + grab_successful = (status == GDK_GRAB_SUCCESS); > + if (!grab_successful) { > d->mouse_grab_active = false; > g_warning("pointer grab failed %u", status); > } else { > @@ -976,7 +978,7 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display) > > end: > g_object_unref(blank); > - return status; > + return grab_successful; > } > > static void update_mouse_pointer(SpiceDisplay *display) > @@ -1023,7 +1025,7 @@ static void try_mouse_grab(SpiceDisplay *display) > if (d->mouse_grab_active) > return; > > - if (do_pointer_grab(display) != GDK_GRAB_SUCCESS) > + if (!do_pointer_grab(display)) > return; > > d->mouse_last_x = -1; > Acked-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx> -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etrunko@xxxxxxxxxx _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel