[Spice-devel] [PATCH spice-gtk 09/10] spice-widget: remove keyboard_grab_count / keyboard_grab_time hack

Hans de Goede hdegoede at redhat.com
Fri Aug 12 07:50:36 PDT 2011


With the filtering of focus in / out events caused by grabs we should no
longer need this.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/spice-widget-priv.h |    2 --
 gtk/spice-widget.c      |   17 -----------------
 2 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h
index 5527ebc..bd6dedb 100644
--- a/gtk/spice-widget-priv.h
+++ b/gtk/spice-widget-priv.h
@@ -105,8 +105,6 @@ struct _SpiceDisplayPrivate {
 
     bool                    keyboard_grab_active;
     bool                    keyboard_have_focus;
-    int                     keyboard_grab_count;
-    time_t                  keyboard_grab_time;
 
     const guint16 const     *keycode_map;
     size_t                  keycode_maplen;
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 30036ce..7afc6eb 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -377,7 +377,6 @@ static void try_keyboard_grab(SpiceDisplay *display)
 {
     GtkWidget *widget = GTK_WIDGET(display);
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
-    time_t now;
     GdkGrabStatus status;
 
     if (d->keyboard_grab_active)
@@ -393,22 +392,6 @@ static void try_keyboard_grab(SpiceDisplay *display)
     g_return_if_fail(gtk_widget_is_focus(widget));
     g_return_if_fail(gtk_widget_has_focus(widget));
 
-    /*
-     * focus / keyboard grab behavior is funky sometime
-     * when going fullscreen (with KDE and GNOME-shell):
-     * focus-in-event -> grab -> focus-out-event -> ungrab -> repeat
-     * I have no idea why the grab triggers focus-out :-(
-     */
-    now = time(NULL);
-    if (d->keyboard_grab_time != now) {
-        d->keyboard_grab_time = now;
-        d->keyboard_grab_count = 0;
-    }
-    if (d->keyboard_grab_count++ > 32) {
-        g_critical("32 grabs last second -> emergency exit");
-        return;
-    }
-
     SPICE_DEBUG("grab keyboard");
 
 #ifdef WIN32
-- 
1.7.5.1



More information about the Spice-devel mailing list