diff options
author | Samuel Fadel <samuel@nihil.ws> | 2022-12-08 14:00:13 +0100 |
---|---|---|
committer | Samuel Fadel <samuel@nihil.ws> | 2022-12-08 14:00:13 +0100 |
commit | a6051a3146da4d99788905c0805890d78ab004da (patch) | |
tree | 5fe89ec29eee5305e33146e6350d8a1eec33f1a0 | |
parent | 8902bfca018b8bd573454ba7fffb7cde5d3983b0 (diff) |
Added dpy_update_window_list() call and impl.
-rw-r--r-- | schewm.c | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -1433,6 +1433,25 @@ find_monitor(const struct Client *client) { } void +dpy_update_window_list(const struct ClientsMap *clients) { + xcb_window_t *windows = NULL; + size_t num_windows = 0; + if (clients->size != 0) { + windows = malloc(clients->size * sizeof(xcb_window_t)); + for (size_t i = 0; i < clients->table_size; i++) { + for (struct ClientList *list = clients->table[i]; + list != NULL; + list = list->next) { + windows[num_windows++] = list->client->id; + } + } + } + + xcb_ewmh_set_client_list(dpy.ewmh, dpy.screen_num, num_windows, windows); + free(windows); +} + +void dpy_destroy() { if (dpy.ewmh) { xcb_ewmh_connection_wipe(dpy.ewmh); @@ -1740,10 +1759,16 @@ wm_init() { wm.is_running = true; wm.focus = NULL; wm.clients = clients_map_new(128); + if (wm.clients == NULL) { + return false; + } wm.cur_workspace = 0; wm.num_workspaces = 10; wm.workspaces = calloc(wm.num_workspaces, sizeof(struct Workspace)); + if (wm.workspaces == NULL) { + return false; + } dpy_set_num_workspaces(); // Look into all existing windows and set them up @@ -1762,14 +1787,14 @@ wm_init() { * Unmap everything we grab initially because they may be * mapped currently, but belong to another workspace; this * way, we can map again only the correct windows at the - * set_workspace() call below. + * wm_set_workspace() call below. */ dpy_unmap_window(window); } } windows_query_reply_free(&reply); - // update_client_list(); + dpy_update_window_list(wm.clients); wm_set_workspace(wm.cur_workspace); // grab_keys(); dpy_grab_key(XCB_MOD_MASK_ANY, XK_q); |