From: Michael Stapelberg Date: Sat, 11 Apr 2009 12:29:15 +0000 (+0200) Subject: Bugfix: Store dock clients per screen, not per workspace. X-Git-Tag: 3.a-bf1~45 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bcbe80072051cd5f0fc1408be8c05d70821aecff;p=i3%2Fi3 Bugfix: Store dock clients per screen, not per workspace. This fixes ticket #12 --- diff --git a/include/data.h b/include/data.h index 21ea722e..87112ac2 100644 --- a/include/data.h +++ b/include/data.h @@ -143,9 +143,6 @@ struct Workspace { Client *fullscreen_client; - /* Contains all clients with _NET_WM_WINDOW_TYPE == _NET_WM_WINDOW_TYPE_DOCK */ - SLIST_HEAD(dock_clients_head, Client) dock_clients; - /* The focus stack contains the clients in the correct order of focus so that the focus can be reverted correctly when a client is closed */ SLIST_HEAD(focus_stack_head, Client) focus_stack; @@ -317,6 +314,9 @@ struct Screen { xcb_window_t bar; xcb_gcontext_t bargc; + /* Contains all clients with _NET_WM_WINDOW_TYPE == _NET_WM_WINDOW_TYPE_DOCK */ + SLIST_HEAD(dock_clients_head, Client) dock_clients; + TAILQ_ENTRY(Screen) screens; }; diff --git a/src/handlers.c b/src/handlers.c index 19ceebd2..88f7ec65 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -623,7 +623,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti if (client->dock) { LOG("Removing from dock clients\n"); - SLIST_REMOVE(&(client->workspace->dock_clients), client, Client, dock_clients); + SLIST_REMOVE(&(client->workspace->screen->dock_clients), client, Client, dock_clients); } LOG("child of 0x%08x.\n", client->frame); diff --git a/src/layout.c b/src/layout.c index dcb48340..23f47cfd 100644 --- a/src/layout.c +++ b/src/layout.c @@ -389,7 +389,7 @@ void render_container(xcb_connection_t *conn, Container *container) { static void render_bars(xcb_connection_t *conn, Workspace *r_ws, int width, int *height) { Client *client; - SLIST_FOREACH(client, &(r_ws->dock_clients), dock_clients) { + SLIST_FOREACH(client, &(r_ws->screen->dock_clients), dock_clients) { LOG("client is at %d, should be at %d\n", client->rect.y, *height); if (client->force_reconfigure | update_if_necessary(&(client->rect.x), 0) | @@ -510,7 +510,7 @@ void render_layout(xcb_connection_t *conn) { /* Reserve space for dock clients */ Client *client; - SLIST_FOREACH(client, &(r_ws->dock_clients), dock_clients) + SLIST_FOREACH(client, &(screen->dock_clients), dock_clients) height -= client->desired_height; /* Space for the internal bar */ diff --git a/src/mainx.c b/src/mainx.c index 9f93888a..c94121fe 100644 --- a/src/mainx.c +++ b/src/mainx.c @@ -227,7 +227,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child, new->titlebar_position = TITLEBAR_OFF; new->force_reconfigure = true; new->container = NULL; - SLIST_INSERT_HEAD(&(c_ws->dock_clients), new, dock_clients); + SLIST_INSERT_HEAD(&(c_ws->screen->dock_clients), new, dock_clients); } } diff --git a/src/table.c b/src/table.c index 222ebdcc..0bf7aa49 100644 --- a/src/table.c +++ b/src/table.c @@ -42,7 +42,6 @@ void init_table() { for (int i = 0; i < 10; i++) { workspaces[i].screen = NULL; workspaces[i].num = i; - SLIST_INIT(&(workspaces[i].dock_clients)); expand_table_cols(&(workspaces[i])); expand_table_rows(&(workspaces[i])); } diff --git a/src/xinerama.c b/src/xinerama.c index 6b8d15ec..4926dfbd 100644 --- a/src/xinerama.c +++ b/src/xinerama.c @@ -182,6 +182,8 @@ static void initialize_screen(xcb_connection_t *conn, i3Screen *screen, Workspac screen->bargc = xcb_generate_id(conn); xcb_create_gc(conn, screen->bargc, screen->bar, 0, 0); + SLIST_INIT(&(screen->dock_clients)); + /* Copy dimensions */ memcpy(&(workspace->rect), &(screen->rect), sizeof(Rect)); LOG("that is virtual screen at %d x %d with %d x %d\n", @@ -265,6 +267,9 @@ void xinerama_requery_screens(xcb_connection_t *conn) { screen->bar = workspaces[c].screen->bar; screen->bargc = workspaces[c].screen->bargc; + /* Copy the list head for the dock clients */ + screen->dock_clients = workspaces[c].screen->dock_clients; + /* Update the dimensions */ memcpy(&(workspaces[c].rect), &(screen->rect), sizeof(Rect)); workspaces[c].screen = screen;