diff --git a/ewmh.c b/ewmh.c index a4995625..977a27e4 100644 --- a/ewmh.c +++ b/ewmh.c @@ -127,6 +127,22 @@ ewmh_update_net_active_window(lua_State *L) return 0; } +static int +ewmh_update_net_client_list(lua_State *L) +{ + xcb_window_t *wins = p_alloca(xcb_window_t, globalconf.clients.len); + + int n = 0; + foreach(client, globalconf.clients) + wins[n++] = (*client)->window; + + xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, + globalconf.screen->root, + _NET_CLIENT_LIST, WINDOW, 32, n, wins); + + return 0; +} + void ewmh_init(void) { @@ -216,23 +232,10 @@ ewmh_init(void) luaA_class_add_signal(globalconf.L, &client_class, "focus", -1); lua_pushcfunction(globalconf.L, ewmh_update_net_active_window); luaA_class_add_signal(globalconf.L, &client_class, "unfocus", -1); -} - -void -ewmh_update_net_client_list(void) -{ - xcb_window_t *wins = p_alloca(xcb_window_t, globalconf.clients.len); - - int n = 0; - foreach(_c, globalconf.clients) - { - client_t *c = *_c; - wins[n++] = c->window; - } - - xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - globalconf.screen->root, - _NET_CLIENT_LIST, XCB_ATOM_WINDOW, 32, n, wins); + lua_pushcfunction(globalconf.L, ewmh_update_net_client_list); + luaA_class_add_signal(globalconf.L, &client_class, "manage", -1); + lua_pushcfunction(globalconf.L, ewmh_update_net_client_list); + luaA_class_add_signal(globalconf.L, &client_class, "unmanage", -1); } /** Set the client list in stacking order, bottom to top. diff --git a/ewmh.h b/ewmh.h index 631f9b58..fc6102a9 100644 --- a/ewmh.h +++ b/ewmh.h @@ -26,7 +26,6 @@ #include "strut.h" void ewmh_init(void); -void ewmh_update_net_client_list(void); void ewmh_update_net_numbers_of_desktop(void); void ewmh_update_net_current_desktop(void); void ewmh_update_net_desktop_names(void); diff --git a/objects/client.c b/objects/client.c index 1fb38187..8e9816cc 100644 --- a/objects/client.c +++ b/objects/client.c @@ -571,8 +571,6 @@ HANDLE_GEOM(height) /* Push client in stack */ client_raise(c); - ewmh_update_net_client_list(); - /* Always stay in NORMAL_STATE. Even though iconified seems more * appropriate sometimes. The only possible loss is that clients not using * visibility events may continue to process data (when banned). @@ -1063,8 +1061,6 @@ client_unmanage(client_t *c) if(strut_has_value(&c->strut)) screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0); - ewmh_update_net_client_list(); - /* Clear our event mask so that we don't receive any events from now on, * especially not for the following requests. */ xcb_change_window_attributes(globalconf.connection,