Fix to ungrab ui/gtk3/switcher for GTK 3.3.18 and GLib 2.31.20
authorfujiwarat <takao.fujiwara1@gmail.com>
Mon, 12 Mar 2012 01:29:23 +0000 (10:29 +0900)
committerfujiwarat <takao.fujiwara1@gmail.com>
Mon, 12 Mar 2012 01:29:23 +0000 (10:29 +0900)
BUG=RH#800897
TEST=Linux desktop

Review URL: https://codereview.appspot.com/5795048

ui/gtk3/switcher.vala

index 76c67ec..131cad5 100644 (file)
@@ -127,6 +127,9 @@ class Switcher : Gtk.Window {
         m_loop.run();
         m_loop = null;
 
+        keyboard.ungrab(Gdk.CURRENT_TIME);
+        pointer.ungrab(Gdk.CURRENT_TIME);
+
         hide();
         // Make sure the switcher is hidden before returning from this function.
         while (Gtk.events_pending())
@@ -239,6 +242,11 @@ class Switcher : Gtk.Window {
             return true;
         }
 
+        // if e.type == Gdk.EventType.KEY_RELEASE, m_loop is already null.
+        if (m_loop == null) {
+            return false;
+        }
+
         m_loop.quit();
         m_result = (int)m_selected_engine;
         return true;