diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-06-21 16:22:29 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2012-06-26 13:40:39 +0200 |
commit | 567b41fdc37dd184506aac7a92f815a212c85daa (patch) | |
tree | d4716c7fe50088b321b08c02330b8de1dd9caf01 | |
parent | cf168467becc342489a954c5fef5b1e9c646e520 (diff) |
spice-gtk-session: Fix keyboard focus tracking
This patch changes the "do we have focus?" tracking, to keeping a counter with
how many widgets have focus. The reason for this is that sometimes multiple
spice-widgets can have focus at the same time, yes really! Sometimes (rarely,
hard to reproduce) the focus in event for one window arrives before the
focus out of the other window.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | gtk/spice-gtk-session.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c index 130cbc9..1d8c888 100644 --- a/gtk/spice-gtk-session.c +++ b/gtk/spice-gtk-session.c @@ -39,7 +39,7 @@ struct _SpiceGtkSessionPrivate { gboolean clipboard_by_guest[CLIPBOARD_LAST]; /* auto-usbredir related */ gboolean auto_usbredir_enable; - gboolean keyboard_focus; + int keyboard_focus; }; /** @@ -845,7 +845,16 @@ void spice_gtk_session_update_keyboard_focus(SpiceGtkSession *self, SpiceGtkSessionPrivate *s = self->priv; SpiceUsbDeviceManager *manager; - s->keyboard_focus = state; + if (state) { + s->keyboard_focus++; + if (s->keyboard_focus != 1) + return; + } else { + g_return_if_fail(s->keyboard_focus > 0); + s->keyboard_focus--; + if (s->keyboard_focus != 0) + return; + } if (!s->auto_usbredir_enable) return; |