Remanage window after property updates (like titles) (#3759)
This commit is contained in:
committed by
Michael Stapelberg
parent
3b88e41dd8
commit
0845d7b264
58
src/con.c
58
src/con.c
@ -1258,34 +1258,17 @@ static bool _con_move_to_con(Con *con, Con *target, bool behind_focused, bool fi
|
||||
|
||||
/* 8. If anything within the container is associated with a startup sequence,
|
||||
* delete it so child windows won't be created on the old workspace. */
|
||||
struct Startup_Sequence *sequence;
|
||||
xcb_get_property_cookie_t cookie;
|
||||
xcb_get_property_reply_t *startup_id_reply;
|
||||
|
||||
if (!con_is_leaf(con)) {
|
||||
Con *child;
|
||||
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
|
||||
if (!child->window)
|
||||
continue;
|
||||
|
||||
cookie = xcb_get_property(conn, false, child->window->id,
|
||||
A__NET_STARTUP_ID, XCB_GET_PROPERTY_TYPE_ANY, 0, 512);
|
||||
startup_id_reply = xcb_get_property_reply(conn, cookie, NULL);
|
||||
|
||||
sequence = startup_sequence_get(child->window, startup_id_reply, true);
|
||||
if (sequence != NULL)
|
||||
startup_sequence_delete(sequence);
|
||||
startup_sequence_delete_by_window(child->window);
|
||||
}
|
||||
}
|
||||
|
||||
if (con->window) {
|
||||
cookie = xcb_get_property(conn, false, con->window->id,
|
||||
A__NET_STARTUP_ID, XCB_GET_PROPERTY_TYPE_ANY, 0, 512);
|
||||
startup_id_reply = xcb_get_property_reply(conn, cookie, NULL);
|
||||
|
||||
sequence = startup_sequence_get(con->window, startup_id_reply, true);
|
||||
if (sequence != NULL)
|
||||
startup_sequence_delete(sequence);
|
||||
startup_sequence_delete_by_window(con->window);
|
||||
}
|
||||
|
||||
/* 9. If the container was marked urgent, move the urgency hint. */
|
||||
@ -2401,3 +2384,40 @@ bool con_swap(Con *first, Con *second) {
|
||||
uint32_t con_rect_size_in_orientation(Con *con) {
|
||||
return (con_orientation(con) == HORIZ ? con->rect.width : con->rect.height);
|
||||
}
|
||||
|
||||
/*
|
||||
* Merges container specific data that should move with the window (e.g. marks,
|
||||
* title format, and the window itself) into another container, and closes the
|
||||
* old container.
|
||||
*
|
||||
*/
|
||||
void con_merge_into(Con *old, Con *new) {
|
||||
new->window = old->window;
|
||||
old->window = NULL;
|
||||
|
||||
if (old->title_format) {
|
||||
FREE(new->title_format);
|
||||
new->title_format = old->title_format;
|
||||
old->title_format = NULL;
|
||||
}
|
||||
|
||||
if (old->sticky_group) {
|
||||
FREE(new->sticky_group);
|
||||
new->sticky_group = old->sticky_group;
|
||||
old->sticky_group = NULL;
|
||||
}
|
||||
|
||||
new->sticky = old->sticky;
|
||||
|
||||
con_set_urgency(new, old->urgent);
|
||||
|
||||
mark_t *mark;
|
||||
TAILQ_FOREACH(mark, &(old->marks_head), marks) {
|
||||
TAILQ_INSERT_TAIL(&(new->marks_head), mark, marks);
|
||||
ipc_send_window_event("mark", new);
|
||||
}
|
||||
new->mark_changed = (TAILQ_FIRST(&(old->marks_head)) != NULL);
|
||||
TAILQ_INIT(&(old->marks_head));
|
||||
|
||||
tree_close_internal(old, DONT_KILL_WINDOW, false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user