return result;
}
-/*
- * Maps all clients (and stack windows) of the given workspace.
- *
- */
-void workspace_map_clients(xcb_connection_t *conn, Workspace *ws) {
- Client *client;
-
- ignore_enter_notify_forall(conn, ws, true);
-
- /* Map all clients on the new workspace */
- FOR_TABLE(ws)
- CIRCLEQ_FOREACH(client, &(ws->table[cols][rows]->clients), clients)
- client_map(conn, client);
-
- /* Map all floating clients */
- if (!ws->floating_hidden)
- TAILQ_FOREACH(client, &(ws->floating_clients), floating_clients)
- client_map(conn, client);
-
- /* Map all stack windows, if any */
- struct Stack_Window *stack_win;
- SLIST_FOREACH(stack_win, &stack_wins, stack_windows)
- if (stack_win->container->workspace == ws && stack_win->rect.height > 0)
- xcb_map_window(conn, stack_win->window);
-
- ignore_enter_notify_forall(conn, ws, false);
-}
-
-/*
- * Unmaps all clients (and stack windows) of the given workspace.
- *
- * This needs to be called separately when temporarily rendering
- * a workspace which is not the active workspace to force
- * reconfiguration of all clients, like in src/xinerama.c when
- * re-assigning a workspace to another screen.
- *
- */
-void workspace_unmap_clients(xcb_connection_t *conn, Workspace *u_ws) {
- Client *client;
- struct Stack_Window *stack_win;
-
- /* Ignore notify events because they would cause focus to be changed */
- ignore_enter_notify_forall(conn, u_ws, true);
-
- /* Unmap all clients of the given workspace */
- int unmapped_clients = 0;
- FOR_TABLE(u_ws)
- CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) {
- DLOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child);
- client_unmap(conn, client);
- unmapped_clients++;
- }
-
- /* To find floating clients, we traverse the focus stack */
- SLIST_FOREACH(client, &(u_ws->focus_stack), focus_clients) {
- if (!client_is_floating(client))
- continue;
-
- DLOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child);
-
- client_unmap(conn, client);
- unmapped_clients++;
- }
-
- /* If we did not unmap any clients, the workspace is empty and we can destroy it, at least
- * if it is not the current workspace. */
- if (unmapped_clients == 0 && u_ws != c_ws) {
- /* Re-assign the workspace of all dock clients which use this workspace */
- Client *dock;
- DLOG("workspace %p is empty\n", u_ws);
- SLIST_FOREACH(dock, &(u_ws->output->dock_clients), dock_clients) {
- if (dock->workspace != u_ws)
- continue;
-
- DLOG("Re-assigning dock client to c_ws (%p)\n", c_ws);
- dock->workspace = c_ws;
- }
- u_ws->output = NULL;
- }
-
- /* Unmap the stack windows on the given workspace, if any */
- SLIST_FOREACH(stack_win, &stack_wins, stack_windows)
- if (stack_win->container->workspace == u_ws)
- xcb_unmap_window(conn, stack_win->window);
-
- ignore_enter_notify_forall(conn, u_ws, false);
-}
#endif
static bool get_urgency_flag(Con *con) {
if (old_flag != ws->urgent)
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"urgent\"}");
}
-
-#if 0
-
-/*
- * Returns the width of the workspace.
- *
- */
-int workspace_width(Workspace *ws) {
- return ws->rect.width;
-}
-
-/*
- * Returns the effective height of the workspace (without the internal bar and
- * without dock clients).
- *
- */
-int workspace_height(Workspace *ws) {
- int height = ws->rect.height;
- i3Font *font = load_font(global_conn, config.font);
-
- /* Reserve space for dock clients */
- Client *client;
- SLIST_FOREACH(client, &(ws->output->dock_clients), dock_clients)
- height -= client->desired_height;
-
- /* Space for the internal bar */
- if (!config.disable_workspace_bar)
- height -= (font->height + 6);
-
- return height;
-}
-#endif