Hi Snir, On Sun, 2015-11-22 at 12:42 +0200, Snir Sheriber wrote: > When using multiple monitors moving mouse between monitors releases > keyboard grab. > > Reproduce bug > -Open multiple monitors remote-viewer session > -Click on one of the monitors to get focus & keyboard-grab > -Move mouse to another monitor and try any keyboard command (do not click) > At this point all keyboard commands are being executed on the client machine > instead of the remote machine > > I added additional session focus test in addition to the > monitor focus test when trying keyboard-grab > > Resolves: rhbz#1275231 > > --- > -I noticed strange behavior when moving into appliction with alt-tab and then > alt-tab again when mouse is above the unfocused monitor, keyboard > is not being grabbed. when the second alt-tab is above the focused monitor > keyboard is grabbed. Good that you have noticed this :) It suggests that the function spice_gtk_session_set_keyboard_grabbed() should be called on another place. Check whether the "unfocused window" gets focus in/out (or enter/leave?) events. Thanks, Pavel > > -No GObject properties was set > --- > --- > src/spice-gtk-session-priv.h | 2 ++ > src/spice-gtk-session.c | 18 ++++++++++++++++++ > src/spice-widget.c | 4 ++-- > 3 files changed, 22 insertions(+), 2 deletions(-) > > diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-session-priv.h > index 91304b2..2a9b752 100644 > --- a/src/spice-gtk-session-priv.h > +++ b/src/spice-gtk-session-priv.h > @@ -28,6 +28,8 @@ gboolean spice_gtk_session_get_read_only(SpiceGtkSession > *self); > void spice_gtk_session_sync_keyboard_modifiers(SpiceGtkSession *self); > void spice_gtk_session_set_pointer_grabbed(SpiceGtkSession *self, gboolean > grabbed); > gboolean spice_gtk_session_get_pointer_grabbed(SpiceGtkSession *self); > +void spice_gtk_session_set_keyboard_grabbed(SpiceGtkSession *self, gboolean > grabbed); > +gboolean spice_gtk_session_get_keyboard_grabbed(SpiceGtkSession *self); > > G_END_DECLS > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c > index 5abb16c..ae478db 100644 > --- a/src/spice-gtk-session.c > +++ b/src/spice-gtk-session.c > @@ -64,6 +64,7 @@ struct _SpiceGtkSessionPrivate { > gboolean auto_usbredir_enable; > int auto_usbredir_reqs; > gboolean pointer_grabbed; > + gboolean keyboard_grabbed; > }; > > /** > @@ -1220,6 +1221,15 @@ void > spice_gtk_session_set_pointer_grabbed(SpiceGtkSession *self, gboolean grabb > g_object_notify(G_OBJECT(self), "pointer-grabbed"); > } > > + > +G_GNUC_INTERNAL > +void spice_gtk_session_set_keyboard_grabbed(SpiceGtkSession *self, gboolean > grabbed) > +{ > + g_return_if_fail(SPICE_IS_GTK_SESSION(self)); > + > + self->priv->keyboard_grabbed = grabbed; > +} > + > G_GNUC_INTERNAL > gboolean spice_gtk_session_get_pointer_grabbed(SpiceGtkSession *self) > { > @@ -1227,3 +1237,11 @@ gboolean > spice_gtk_session_get_pointer_grabbed(SpiceGtkSession *self) > > return self->priv->pointer_grabbed; > } > + > +G_GNUC_INTERNAL > +gboolean spice_gtk_session_get_keyboard_grabbed(SpiceGtkSession *self) > +{ > + g_return_val_if_fail(SPICE_IS_GTK_SESSION(self), FALSE); > + > + return self->priv->keyboard_grabbed; > +} > diff --git a/src/spice-widget.c b/src/spice-widget.c > index 503f82a..b2c03a3 100644 > --- a/src/spice-widget.c > +++ b/src/spice-widget.c > @@ -206,9 +206,9 @@ static void update_size_request(SpiceDisplay *display) > static void update_keyboard_focus(SpiceDisplay *display, gboolean state) > { > SpiceDisplayPrivate *d = display->priv; > - > d->keyboard_have_focus = state; > > + spice_gtk_session_set_keyboard_grabbed(d->gtk_session, state); > /* keyboard grab gets inhibited by usb-device-manager when it is > in the process of redirecting a usb-device (as this may show a > policykit dialog). Making autoredir/automount setting changes while > @@ -737,7 +737,7 @@ static void try_keyboard_grab(SpiceDisplay *display) > return; > if (d->keyboard_grab_active) > return; > - if (!d->keyboard_have_focus) > + if (!spice_gtk_session_get_keyboard_grabbed(d->gtk_session)) > return; > if (!d->mouse_have_pointer) > return; _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel