Add client_ban_unfocus
client_ban_unfocus() generates the unfocus events that client_ban() would generate, but it doesn't do the actual banning. Signed-off-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
67e5346956
commit
9a56a3ad4b
20
client.c
20
client.c
|
@ -335,6 +335,19 @@ client_set_focus(client_t *c, bool set_input_focus)
|
||||||
window_takefocus(c->window);
|
window_takefocus(c->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Prepare banning a client by running all needed lua events.
|
||||||
|
* \param c The client.
|
||||||
|
*/
|
||||||
|
void client_ban_unfocus(client_t *c)
|
||||||
|
{
|
||||||
|
if(globalconf.screens.tab[c->phys_screen].prev_client_focus == c)
|
||||||
|
globalconf.screens.tab[c->phys_screen].prev_client_focus = NULL;
|
||||||
|
|
||||||
|
/* Wait until the last moment to take away the focus from the window. */
|
||||||
|
if(globalconf.screens.tab[c->phys_screen].client_focus == c)
|
||||||
|
client_unfocus(c);
|
||||||
|
}
|
||||||
|
|
||||||
/** Ban client and move it out of the viewport.
|
/** Ban client and move it out of the viewport.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
*/
|
*/
|
||||||
|
@ -347,12 +360,7 @@ client_ban(client_t *c)
|
||||||
|
|
||||||
c->isbanned = true;
|
c->isbanned = true;
|
||||||
|
|
||||||
if(globalconf.screens.tab[c->phys_screen].prev_client_focus == c)
|
client_ban_unfocus(c);
|
||||||
globalconf.screens.tab[c->phys_screen].prev_client_focus = NULL;
|
|
||||||
|
|
||||||
/* Wait until the last moment to take away the focus from the window. */
|
|
||||||
if(globalconf.screens.tab[c->phys_screen].client_focus == c)
|
|
||||||
client_unfocus(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
client.h
1
client.h
|
@ -163,6 +163,7 @@ LUA_OBJECT_FUNCS(client_class, client_t, client)
|
||||||
bool client_maybevisible(client_t *, screen_t *);
|
bool client_maybevisible(client_t *, screen_t *);
|
||||||
client_t * client_getbywin(xcb_window_t);
|
client_t * client_getbywin(xcb_window_t);
|
||||||
void client_ban(client_t *);
|
void client_ban(client_t *);
|
||||||
|
void client_ban_unfocus(client_t *);
|
||||||
void client_unban(client_t *);
|
void client_unban(client_t *);
|
||||||
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, bool);
|
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, bool);
|
||||||
area_t client_geometry_hints(client_t *, area_t);
|
area_t client_geometry_hints(client_t *, area_t);
|
||||||
|
|
Loading…
Reference in New Issue