diff --git a/objects/client.c b/objects/client.c index 800e541bf..60463de06 100644 --- a/objects/client.c +++ b/objects/client.c @@ -224,21 +224,6 @@ client_hasproto(client_t *c, xcb_atom_t atom) 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) - xwindow_takefocus(c->window); -} - /** Prepare banning a client by running all needed lua events. * \param c The client. */ @@ -351,10 +336,16 @@ client_focus(client_t *c) /* X11 doesn't let you focus a window that isn't viewable */ client_unban(c); + /* Sets focus on window - using xcb_set_input_focus or WM_TAKE_FOCUS */ + if(!c->nofocus) + xcb_set_input_focus(globalconf.connection, XCB_INPUT_FOCUS_PARENT, + c->window, globalconf.timestamp); + + if(client_hasproto(c, WM_TAKE_FOCUS)) + xwindow_takefocus(c->window); + if (!c->nofocus) client_focus_update(c); - - client_set_focus(c, !c->nofocus); } static void diff --git a/objects/client.h b/objects/client.h index 2ce1bc3ab..952c91184 100644 --- a/objects/client.h +++ b/objects/client.h @@ -171,7 +171,6 @@ void client_set_skip_taskbar(lua_State *, int, bool); void client_focus(client_t *); void client_focus_update(client_t *); bool client_hasproto(client_t *, xcb_atom_t); -void client_set_focus(client_t *, bool); void client_ignore_enterleave_events(void); void client_restore_enterleave_events(void); void client_class_setup(lua_State *);