*/
void client_change_border(xcb_connection_t *conn, Client *client, char border_type);
+/**
+ * Unmap the client, correctly setting any state which is needed.
+ *
+ */
+void client_unmap(xcb_connection_t *conn, Client *client);
+
+/**
+ * Map the client, correctly restoring any state needed.
+ *
+ */
+void client_map(xcb_connection_t *conn, Client *client);
+
#endif
redecorate_window(conn, client);
}
+
+/*
+ * Unmap the client, correctly setting any state which is needed.
+ *
+ */
+void client_unmap(xcb_connection_t *conn, Client *client) {
+ /* Set WM_STATE_WITHDRAWN, it seems like Java apps need it */
+ long data[] = { XCB_WM_STATE_WITHDRAWN, XCB_NONE };
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client->child, atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);
+
+ xcb_unmap_window(conn, client->frame);
+}
+
+/*
+ * Map the client, correctly restoring any state needed.
+ *
+ */
+void client_map(xcb_connection_t *conn, Client *client) {
+ /* Set WM_STATE_NORMAL because GTK applications don’t want to drag & drop if we don’t.
+ * Also, xprop(1) needs that to work. */
+ long data[] = { XCB_WM_STATE_NORMAL, XCB_NONE };
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client->child, atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);
+
+ xcb_map_window(conn, client->frame);
+}
/* If we’re moving it to an invisible screen, we need to unmap it */
if (!workspace_is_visible(t_ws)) {
LOG("This workspace is not visible, unmapping\n");
- xcb_unmap_window(conn, client->frame);
+ client_unmap(conn, client);
} else {
/* If this is not the case, we move the window to a workspace
* which is on another screen, so we also need to adjust its
/* If we’re moving it to an invisible screen, we need to unmap it */
if (!workspace_is_visible(to_container->workspace)) {
LOG("This workspace is not visible, unmapping\n");
- xcb_unmap_window(conn, current_client->frame);
+ client_unmap(conn, current_client);
} else {
if (current_client->fullscreen) {
LOG("Calling client_enter_fullscreen again\n");
LOG("floating_hidden is now: %d\n", workspace->floating_hidden);
TAILQ_FOREACH(client, &(workspace->floating_clients), floating_clients) {
if (workspace->floating_hidden)
- xcb_unmap_window(conn, client->frame);
- else xcb_map_window(conn, client->frame);
+ client_unmap(conn, client);
+ else client_map(conn, client);
}
/* If we just unmapped all floating windows we should ensure that the focus
LOG("child of 0x%08x.\n", client->frame);
xcb_reparent_window(conn, client->child, root, 0, 0);
+
+ client_unmap(conn, client);
+
xcb_destroy_window(conn, client->frame);
xcb_flush(conn);
table_remove(&by_parent, client->frame);
/* Yo dawg, I heard you like windows, so I create a window around your window… */
new->frame = create_window(conn, framerect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, false, mask, values);
- /* Set WM_STATE_NORMAL because GTK applications don’t want to drag & drop if we don’t.
- * Also, xprop(1) needs that to work. */
- long data[] = { XCB_WM_STATE_NORMAL, XCB_NONE };
- xcb_change_property(conn, XCB_PROP_MODE_REPLACE, new->child, atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);
-
/* Put the client inside the save set. Upon termination (whether killed or normal exit
does not matter) of the window manager, these clients will be correctly reparented
to their most closest living ancestor (= cleanup) */
xcb_map_window(conn, child);
if (map_frame) {
LOG("Mapping client\n");
- xcb_map_window(conn, new->frame);
+ client_map(conn, new);
}
if (CUR_CELL->workspace->fullscreen_client == NULL && !new->dock) {
/* Focus the new window if we’re not in fullscreen mode and if it is not a dock window */
/* Map all clients on the new workspace */
FOR_TABLE(ws)
CIRCLEQ_FOREACH(client, &(ws->table[cols][rows]->clients), clients)
- xcb_map_window(conn, client->frame);
+ client_map(conn, client);
/* Map all floating clients */
if (!ws->floating_hidden)
TAILQ_FOREACH(client, &(ws->floating_clients), floating_clients)
- xcb_map_window(conn, client->frame);
+ client_map(conn, client);
/* Map all stack windows, if any */
struct Stack_Window *stack_win;
FOR_TABLE(u_ws)
CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) {
LOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child);
- xcb_unmap_window(conn, client->frame);
+ client_unmap(conn, client);
unmapped_clients++;
}
LOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child);
- xcb_unmap_window(conn, client->frame);
+ client_unmap(conn, client);
unmapped_clients++;
}