[Spice-devel,spice-gtk,10/10] spice-widget: release_keys on focus out

Submitted by Hans de Goede on Aug. 12, 2011, 9:50 p.m.

Details

Message ID 1313160637-5187-10-git-send-email-hdegoede@redhat.com
State New, archived
Headers show

Not browsing as part of any series.

Commit Message

Hans de Goede Aug. 12, 2011, 9:50 p.m.
This fixes alt getting stuck in the guest when the user alt-tabs away from the
spice-widget (thus making it see the alt press but not the release) and then
closing it without giving it the focus back (by using the windows close button
for example).

Note that doing this on focus out (when we know we may be missing key releases
afterwards) makes a lot more sense then doing this on focus in, and with
the release_keys on focus out I don't really see a reason any more to do it
on focus in. But I'm leaving it in on focus in just in case, it certainly
cannot hurt there.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 gtk/spice-widget.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 7afc6eb..2015854 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -902,6 +902,7 @@  static gboolean focus_out_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_U
     if (d->keyboard_grab_active)
         return true;
 
+    release_keys(display);
     d->keyboard_have_focus = false;
     update_auto_usbredir(display);
     return true;

Comments

Looks good, ack from me

Christophe

On Fri, Aug 12, 2011 at 04:50:37PM +0200, Hans de Goede wrote:
> This fixes alt getting stuck in the guest when the user alt-tabs away from the
> spice-widget (thus making it see the alt press but not the release) and then
> closing it without giving it the focus back (by using the windows close button
> for example).
> 
> Note that doing this on focus out (when we know we may be missing key releases
> afterwards) makes a lot more sense then doing this on focus in, and with
> the release_keys on focus out I don't really see a reason any more to do it
> on focus in. But I'm leaving it in on focus in just in case, it certainly
> cannot hurt there.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  gtk/spice-widget.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> index 7afc6eb..2015854 100644
> --- a/gtk/spice-widget.c
> +++ b/gtk/spice-widget.c
> @@ -902,6 +902,7 @@ static gboolean focus_out_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_U
>      if (d->keyboard_grab_active)
>          return true;
>  
> +    release_keys(display);
>      d->keyboard_have_focus = false;
>      update_auto_usbredir(display);
>      return true;
> -- 
> 1.7.5.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel