[Spice-devel] [PATCH spice-gtk 09/11] Grab on the display too

Hans de Goede hdegoede at redhat.com
Thu Dec 8 07:31:44 PST 2011


ACK.

On 12/08/2011 03:12 PM, Marc-André Lureau wrote:
> Without this additional grab, the pointer grab was effective for the
> whole application
> ---
>   gtk/spice-widget.c |   10 ++++++++++
>   1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> index 2cc1017..1fa54c3 100644
> --- a/gtk/spice-widget.c
> +++ b/gtk/spice-widget.c
> @@ -537,6 +537,8 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
>           g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, true);
>       }
>
> +    gtk_grab_add(GTK_WIDGET(display));
> +
>       return status;
>   }
>
> @@ -631,7 +633,10 @@ static void try_mouse_ungrab(SpiceDisplay *display)
>           return;
>
>       gdk_pointer_ungrab(GDK_CURRENT_TIME);
> +    gtk_grab_remove(GTK_WIDGET(display));
> +
>       d->mouse_grab_active = false;
> +
>       update_mouse_pointer(display);
>       g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false);
>   }
> @@ -939,8 +944,13 @@ static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC
>       SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
>
>       SPICE_DEBUG("%s", __FUNCTION__);
> +
> +    if (d->mouse_grab_active)
> +        return true;
> +
>       d->mouse_have_pointer = false;
>       try_keyboard_ungrab(display);
> +
>       return true;
>   }
>


More information about the Spice-devel mailing list