client: call unfocus hook when we changed focused client (FS#454)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-02-19 16:27:06 +01:00
parent a95fc407b5
commit f711503d7b
1 changed files with 11 additions and 9 deletions

View File

@ -286,15 +286,8 @@ client_focus(client_t *c)
if (!window_hasproto(c->win, WM_TAKE_FOCUS) && c->nofocus)
return;
/* unfocus current selected client
* We don't really need to unfocus here,
* because client already received FocusOut event.
* What we need to do is call unfocus hook, to
* inform lua script, about this event.
*/
if(globalconf.screen_focus->client_focus
&& c != globalconf.screen_focus->client_focus)
client_unfocus_hook(globalconf.screen_focus->client_focus);
/* Save current focused client */
client_t *focused_before = globalconf.screen_focus->client_focus;
/* stop hiding c */
c->ishidden = false;
@ -319,6 +312,15 @@ client_focus(client_t *c)
* And anyway, we have maybe unhidden */
client_need_arrange(c);
/* unfocus current selected client
* We don't really need to unfocus here,
* because client already received FocusOut event.
* What we need to do is call unfocus hook, to
* inform lua script, about this event.
*/
if(focused_before && c != focused_before)
client_unfocus_hook(focused_before);
/* execute hook */
if(globalconf.hooks.focus != LUA_REFNIL)
{