Simplify client focus code
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
4b61aefca6
commit
9f05eaf652
22
client.c
22
client.c
|
@ -320,21 +320,6 @@ client_hasproto(client_t *c, xcb_atom_t atom)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets focus on window - using xcb_set_input_focus or WM_TAKE_FOCUS
|
|
||||||
* \param c Client that should get focus
|
|
||||||
* \param set_input_focus Should we call xcb_set_input_focus
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
client_set_focus(client_t *c, bool set_input_focus)
|
|
||||||
{
|
|
||||||
bool takefocus = client_hasproto(c, WM_TAKE_FOCUS);
|
|
||||||
if(set_input_focus)
|
|
||||||
xcb_set_input_focus(globalconf.connection, XCB_INPUT_FOCUS_PARENT,
|
|
||||||
c->window, globalconf.timestamp);
|
|
||||||
if(takefocus)
|
|
||||||
window_takefocus(c->window);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Prepare banning a client by running all needed lua events.
|
/** Prepare banning a client by running all needed lua events.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
*/
|
*/
|
||||||
|
@ -447,9 +432,14 @@ client_focus(client_t *c)
|
||||||
client_unban(c);
|
client_unban(c);
|
||||||
|
|
||||||
if (!c->nofocus)
|
if (!c->nofocus)
|
||||||
|
{
|
||||||
client_focus_update(c);
|
client_focus_update(c);
|
||||||
|
xcb_set_input_focus(globalconf.connection, XCB_INPUT_FOCUS_PARENT,
|
||||||
|
c->window, globalconf.timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
client_set_focus(c, !c->nofocus);
|
if(client_hasproto(c, WM_TAKE_FOCUS))
|
||||||
|
window_takefocus(c->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Stack a window below.
|
/** Stack a window below.
|
||||||
|
|
1
client.h
1
client.h
|
@ -201,7 +201,6 @@ void client_unfocus(client_t *);
|
||||||
void client_unfocus_update(client_t *);
|
void client_unfocus_update(client_t *);
|
||||||
void client_stack_refresh(void);
|
void client_stack_refresh(void);
|
||||||
bool client_hasproto(client_t *, xcb_atom_t);
|
bool client_hasproto(client_t *, xcb_atom_t);
|
||||||
void client_set_focus(client_t *, bool);
|
|
||||||
void client_ignore_enterleave_events(void);
|
void client_ignore_enterleave_events(void);
|
||||||
void client_restore_enterleave_events(void);
|
void client_restore_enterleave_events(void);
|
||||||
void client_class_setup(lua_State *);
|
void client_class_setup(lua_State *);
|
||||||
|
|
Loading…
Reference in New Issue