[Spice-devel] [PATCH spice-gtk] spice-widget: fixing issue with keyboard already grabbed

Victor Toso victortoso at redhat.com
Mon May 21 08:33:51 UTC 2018


Hi,

Thanks for trying to fix this issue.

On Mon, May 21, 2018 at 12:50:38AM -0300, Julio Faracco wrote:
> For some reason, after unlocking a locked screen, spice receives an
> enter event before focus-in event (this possible a Gtk issue).

Yes..

> This wrong sequence of events is causing a wrong mouse focus.
> This operation gives to enter event the ability to grab
> keyboard and when focus-in event is raised, keyboard is already
> grabbed by enter event.

.. or we can move back to the deprecated gtk apis that don't
seem to trigger this issue - i.e not using gdk_seat_grab* which
are surrounded by GTK_CHECK_VERSION(3, 20, 0) in spice-widget.c

> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1485968
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1571422
>
> Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> ---
>  src/spice-widget.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 767550b..650c314 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1805,8 +1805,12 @@ static gboolean enter_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC
>
>      DISPLAY_DEBUG(display, "%s", __FUNCTION__);
>
> -    d->mouse_have_pointer = true;
> -    spice_gtk_session_set_mouse_has_pointer(d->gtk_session, true);
> +    if (spice_gtk_session_get_keyboard_has_focus(d->gtk_session) &&
> +        spice_gtk_session_get_mouse_has_pointer(d->gtk_session)) {

Note that we can have the mouse pointer even without keyboard
grab so, I'm not sure this is correct in all possible scenarios
(wayland/x11 and windows).

I'm waiting for feedback from gtk+ folks in both bugs that you
have mentioned. It might be that there is a bug in spice-gtk but
as you have mentioned, the order of the events are weird here and
it seems to happen only when user is going to lock the screen.

Cheers,
        toso

> +        d->mouse_have_pointer = true;
> +        spice_gtk_session_set_mouse_has_pointer(d->gtk_session, true);
> +    }
> +
>      try_keyboard_grab(display);
>      update_display(display);
>
> --
> 2.17.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180521/8cc8ee79/attachment.sig>


More information about the Spice-devel mailing list