Stop the escape timeout on focus-out-event
authorTommi Komulainen <tommi.komulainen@nokia.com>
Thu, 7 Jun 2007 11:22:48 +0000 (11:22 +0000)
committerTommi Komulainen <tommi.komulainen@nokia.com>
Thu, 7 Jun 2007 11:22:48 +0000 (11:22 +0000)
2007-06-07  Tommi Komulainen  <tommi.komulainen@nokia.com>

* src/hildon-window.c (hildon_window_window_state_event,
hildon_window_is_topmost_notify, hildon_window_class_init): Stop the
escape timeout on focus-out-event rather than notify::is-topmost; the
latter doesn't get called when menus pop up. Fixes: NB#52946, MB#1101

ChangeLog
src/hildon-window.c

index a65a096..dae85a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-06-07  Tommi Komulainen  <tommi.komulainen@nokia.com>
+
+       * src/hildon-window.c (hildon_window_window_state_event,
+       hildon_window_is_topmost_notify, hildon_window_class_init): Stop the
+       escape timeout on focus-out-event rather than notify::is-topmost; the
+       latter doesn't get called when menus pop up. Fixes: NB#52946, MB#1101
+
 2007-06-07  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
 
        * src/hildon-window.c: Adding a patch from Tommi Komulainen to pass the
index eaa07a1..d100dfe 100644 (file)
@@ -185,6 +185,9 @@ hildon_window_key_release_event                 (GtkWidget *widget,
 static gboolean
 hildon_window_window_state_event                (GtkWidget *widget, 
                                                  GdkEventWindowState *event);
+static gboolean
+hildon_window_focus_out_event                   (GtkWidget *widget, 
+                                                 GdkEventFocus *event);
 
 static void
 hildon_window_notify                            (GObject *gobject, 
@@ -290,6 +293,7 @@ hildon_window_class_init                        (HildonWindowClass * window_clas
     widget_class->key_press_event       = hildon_window_key_press_event;
     widget_class->key_release_event     = hildon_window_key_release_event;
     widget_class->window_state_event    = hildon_window_window_state_event;
+    widget_class->focus_out_event       = hildon_window_focus_out_event;
 
     /* now the object stuff */
     object_class->finalize              = hildon_window_finalize;
@@ -1219,6 +1223,25 @@ hildon_window_window_state_event                (GtkWidget *widget,
 }
 
 /*
+ * If the window lost focus while the user started to press the ESC key, we
+ * won't get the release event. We need to stop the timeout.
+ */
+static gboolean
+hildon_window_focus_out_event                   (GtkWidget *widget, 
+                                                 GdkEventFocus *event)
+{
+  HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (widget);
+
+  if (priv->escape_timeout)
+  {
+      g_source_remove (priv->escape_timeout);
+      priv->escape_timeout = 0;
+  }
+
+  return GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, event);
+}
+
+/*
  * The menu popuping needs a menu popup-function
  */
 static void
@@ -1274,18 +1297,6 @@ hildon_window_is_topmost_notify                 (HildonWindow *window)
     {
         hildon_window_take_common_toolbar (window);
     }
-
-    else
-    {
-        /* If the window lost focus while the user started to press
-         * the ESC key, we won't get the release event. We need to
-         * stop the timeout*/
-        if (priv->escape_timeout)
-        {
-            g_source_remove (priv->escape_timeout);
-            priv->escape_timeout = 0;
-        }
-    }
 }
 
 /*