diff --git a/ewmh.c b/ewmh.c index 236c941a..be31aced 100644 --- a/ewmh.c +++ b/ewmh.c @@ -93,8 +93,8 @@ ewmh_update_net_active_window(lua_State *L) { xcb_window_t win; - if(globalconf.client_focus) - win = globalconf.client_focus->window; + if(globalconf.focus.client) + win = globalconf.focus.client->window; else win = XCB_NONE; diff --git a/globalconf.h b/globalconf.h index 4ae07771..2027ea76 100644 --- a/globalconf.h +++ b/globalconf.h @@ -80,8 +80,12 @@ typedef struct int keygrabber; /** The mouse pointer grabber function */ int mousegrabber; - /** Focused client */ - client_t *client_focus; + /** Input focus information */ + struct + { + /** Focused client */ + client_t *client; + } focus; /** Drawins */ drawin_array_t drawins; /** The startup notification display struct */ diff --git a/objects/client.c b/objects/client.c index 9d3f745a..2a05f66d 100644 --- a/objects/client.c +++ b/objects/client.c @@ -187,7 +187,7 @@ client_getbyframewin(xcb_window_t w) static void client_unfocus_update(client_t *c) { - globalconf.client_focus = NULL; + globalconf.focus.client = NULL; luaA_object_push(globalconf.L, c); luaA_object_emit_signal(globalconf.L, -1, "unfocus", 0); @@ -232,7 +232,7 @@ client_hasproto(client_t *c, xcb_atom_t atom) void client_ban_unfocus(client_t *c) { /* Wait until the last moment to take away the focus from the window. */ - if(globalconf.client_focus == c) + if(globalconf.focus.client == c) client_unfocus(c); } @@ -296,16 +296,16 @@ client_focus_update(client_t *c) if(!client_maybevisible(c, c->screen)) return; - if(globalconf.client_focus) + if(globalconf.focus.client) { - if (globalconf.client_focus != c) - client_unfocus_update(globalconf.client_focus); + if (globalconf.focus.client != c) + client_unfocus_update(globalconf.focus.client); else /* Already focused */ return; } - globalconf.client_focus = c; + globalconf.focus.client = c; /* according to EWMH, we have to remove the urgent state from a client */ luaA_object_push(globalconf.L, c); @@ -944,7 +944,7 @@ client_unmanage(client_t *c, bool window_valid) tc->transient_for = NULL; } - if(globalconf.client_focus == c) + if(globalconf.focus.client == c) client_unfocus(c); /* remove client from global list and everywhere else */ @@ -1648,7 +1648,7 @@ luaA_client_module_index(lua_State *L) const char *buf = luaL_checkstring(L, 2); if(a_strcmp(buf, "focus") == 0) - return luaA_object_push(globalconf.L, globalconf.client_focus); + return luaA_object_push(globalconf.L, globalconf.focus.client); return 0; } diff --git a/stack.c b/stack.c index 33f4365b..75d8cb0d 100644 --- a/stack.c +++ b/stack.c @@ -134,7 +134,7 @@ client_layer_translator(client_t *c) if(c->ontop) return WINDOW_LAYER_ONTOP; /* Fullscreen windows only get their own layer when they have the focus */ - else if(c->fullscreen && globalconf.client_focus == c) + else if(c->fullscreen && globalconf.focus.client == c) return WINDOW_LAYER_FULLSCREEN; else if(c->above) return WINDOW_LAYER_ABOVE;