* and the window is expected to kill itself.
*
*/
-bool tree_close(Con *con, bool kill_window, bool dont_kill_parent) {
+bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent) {
bool was_mapped = con->mapped;
Con *parent = con->parent;
}
if (con->window != NULL) {
- if (kill_window) {
- x_window_kill(con->window->id);
+ if (kill_window != DONT_KILL_WINDOW) {
+ x_window_kill(con->window->id, kill_window);
return false;
} else {
/* un-parent the window */
xcb_reparent_window(conn, con->window->id, root, 0, 0);
- /* TODO: client_unmap to set state to withdrawn */
-
+ /* We are no longer handling this window, thus set WM_STATE to
+ * WM_STATE_WITHDRAWN (see ICCCM 4.1.3.1) */
+ long data[] = { XCB_ICCCM_WM_STATE_WITHDRAWN, XCB_NONE };
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, con->window->id,
+ A_WM_STATE, A_WM_STATE, 32, 2, data);
}
FREE(con->window->class_class);
FREE(con->window->class_instance);
if (con_is_floating(con)) {
Con *ws = con_get_workspace(con);
DLOG("Container was floating, killing floating container\n");
- tree_close(parent, false, false);
+ tree_close(parent, DONT_KILL_WINDOW, false);
DLOG("parent container killed\n");
if (con == focused) {
DLOG("This is the focused container, i need to find another one to focus. I start looking at ws = %p\n", ws);
}
if (was_mapped || con == focused) {
- if (kill_window || !dont_kill_parent || con == focused) {
+ if ((kill_window != DONT_KILL_WINDOW) || !dont_kill_parent || con == focused) {
DLOG("focusing %p / %s\n", next, next->name);
/* TODO: check if the container (or one of its children) was focused */
if (next->type == CT_DOCKAREA) {
* Closes the current container using tree_close().
*
*/
-void tree_close_con() {
+void tree_close_con(kill_window_t kill_window) {
assert(focused != NULL);
if (focused->type == CT_WORKSPACE) {
LOG("Cannot close workspace\n");
assert(focused->type != CT_ROOT);
/* Kill con */
- tree_close(focused, true, false);
+ tree_close(focused, kill_window, false);
}
/*
/* 4: close the redundant cons */
DLOG("closing redundant cons\n");
- tree_close(con, false, true);
+ tree_close(con, DONT_KILL_WINDOW, true);
/* Well, we got to abort the recursion here because we destroyed the
* container. However, if tree_flatten() is called sufficiently often,