[Spice-devel] [PATCH spice-gtk 1/3] spice-widget: release mouse grab on keyboard-grab-inhibit

Marc-André Lureau marcandre.lureau at gmail.com
Thu Aug 2 03:35:45 PDT 2012


ack

On Sat, Jul 28, 2012 at 11:40 AM, Hans de Goede <hdegoede at redhat.com> wrote:
> The purpose of the keyboard-grab-inihbit mechanism is to allow other apps
> to grab the input while the spice-widget has the focus, mainly when we're
> going to invoke policykit for usb-redirection, as that the policy-kit
> agent may want to grab the input.
>
> Before this patch we were only inhibitting the keyboard grab, which works fine
> for vms which are in client mouse mode, but is not enough for vms which are
> in server mouse mode.
>
> This patch also releases the mouse grab on keyboard-grab-inhibit, fixing
> the policykit dialog not showing (and thus usb redir not working) when
> running with server mouse mode. Note that this makes the inhibit-keyboard-grab
> name of the property no longer really cover what it does, but allas it is
> part of our ABI...
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  gtk/spice-widget.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> index 02bb089..2bb7b38 100644
> --- a/gtk/spice-widget.c
> +++ b/gtk/spice-widget.c
> @@ -372,6 +372,7 @@ static void session_inhibit_keyboard_grab_changed(GObject    *gobject,
>      g_object_get(d->session, "inhibit-keyboard-grab",
>                   &d->keyboard_grab_inhibit, NULL);
>      update_keyboard_grab(display);
> +    update_mouse_grab(display);
>  }
>
>  static void spice_display_dispose(GObject *obj)
> @@ -844,7 +845,9 @@ static void update_mouse_grab(SpiceDisplay *display)
>  {
>      SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
>
> -    if (d->mouse_grab_enable && !d->disable_inputs)
> +    if (d->mouse_grab_enable &&
> +        !d->keyboard_grab_inhibit &&
> +        !d->disable_inputs)
>          try_mouse_grab(display);
>      else
>          try_mouse_ungrab(display);
> --
> 1.7.10.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list