Ignore (Un)Grab focus notifies
commit10fa808a5af56d3c67bd6255991eae607a3b20ae
authorUli Schlachter <psychon@znc.in>
Sun, 8 Jul 2012 13:41:16 +0000 (8 15:41 +0200)
committerUli Schlachter <psychon@znc.in>
Sun, 8 Jul 2012 13:41:16 +0000 (8 15:41 +0200)
treec3cbb092e78dee214819ff37a3b56a2d39c9d9b1
parent41283f508c7eb8e8ef139f87bff6950b1aa6b905
Ignore (Un)Grab focus notifies

When a keyboard grab activate/deactives, the input focus jumps to the window
which does the grab. These FocusIn events sometimes managed to confuse awesome.
The symptom was that a newly mapped/started client didn't receive the input
focus:

- You press your key-combo to start a terminal. This activates a passive grab
  and the input focus jumps to the root window
- The terminal opens and the "manage" rule does client.focus = c
- This doesn't set the focus yet, but instead causes
  globalconf.focus.need_update = true and .client = new_terminal
- Before the focus is updated, the key combo is released and the focus jumps
  back to the previously focused client
- The FocusIn with mode == Ungrab causes awesome to think that the previously
  focused client got focused again and thus globalconf.client.focus gets re-set
  to what it was before
- Finally the focus is refreshed and the previously focused client gets focused

The fix is simple: We don't need the FocusIn events which are generated when a
grab activates or deactivates, so we can just ignore them.

Thanks to Majic for reporting this to me.

Signed-off-by: Uli Schlachter <psychon@znc.in>
event.c