title: Giving window focus in Gtk3
body: <p>I'm using Python 2.7.4 with Gtk3 on Ubuntu 13.10.</p>
  
  <p>I'm using the Keybinder library to hide and show my Gtk window using a hotkey. Now, when my window does show up using the hotkey, it does not always receive focus.</p>
  
  <p>The concerned code is below:</p>
  
  <pre><code>def toggle(self, key, data):
      if self.hidden:
          self.hidden = False
          self.set_keep_above(True)
          self.set_accept_focus(True)
          self.present()
          self.enteredName.grab_focus()
      else:
          self.hidden = True
          self.hide()
  </code></pre>
  
  <p>Here, <code>self</code> refers to the Gtk window and <code>self.enteredName</code> is a widget of type <code>Gtk.Entry()</code>.</p>
  
  <p>Normally, the combination of <code>set_accept_focus()</code>, <code>set_keep_above()</code>, followed by <code>present()</code> works. Without the <code>set_keep_above</code>, my window doesn't rise to the top. Without the <code>set_accept_focus</code>, my window doesn't get keyboard focus.</p>
  
  <p>The above set up works when I just start my app and then test it using the hotkey (hiding and showing it). My window always receives keyboard focus. Howver, let's say I have a GVim window opened and I've given keyboard focus to it. On pressing the hotkey, my window shows up on the top (even on top of the GVim window), but the keyboard focus still lies with the GVim window.</p>
  
  <p>I've tried several combinations (by adding <code>activate</code>), and grabbing focus on a text widget. But it's not working as expected.</p>
  
  <p>Anything I'm missing here?</p>