Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made state consistent with window in remanage_window #4448

Open
wants to merge 3 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/x.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ void x_move_win(Con *src, Con *dest);
*/
void x_reparent_child(Con *con, Con *old);

/**
* Reparents child window from old con into new con. The reparenting happens in
* the next call of x_push_changes(). Unlike x_reparent_child & x_move_win, this
* function assumes that the old con is about to be destroyed and preserves
* window_rect and child_mapped.
*
*/
void x_reparent_child2(Con *new, Con *old);

/**
* Re-initializes the associated X window state for this container. You have
* to call this when you assign a client to an empty container to ensure that
Expand Down
2 changes: 1 addition & 1 deletion src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ Con *remanage_window(Con *con) {

xcb_window_t old_frame = _match_depth(con->window, nc);

x_reparent_child(nc, con);
x_reparent_child2(nc, con);

bool moved_workpaces = (con_get_workspace(nc) != con_get_workspace(con));

Expand Down
28 changes: 28 additions & 0 deletions src/x.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,34 @@ void x_move_win(Con *src, Con *dest) {
}
}

/*
* Reparents child window from old con into new con. The reparenting happens in
* the next call of x_push_changes(). Unlike x_reparent_child & x_move_win, this
* function assumes that the old con is about to be destroyed and preserves
* window_rect and child_mapped.
*
*/
void x_reparent_child2(Con *new, Con *old) {
izzel marked this conversation as resolved.
Show resolved Hide resolved
struct con_state *new_state, *old_state;

if ((new_state = state_for_frame(new->frame.id)) == NULL) {
ELOG("window state for new con not found\n");
return;
}

if ((old_state = state_for_frame(old->frame.id)) == NULL) {
ELOG("window state for old con not found\n");
return;
}

new_state->need_reparent = true;
new_state->old_frame = old->frame.id;

new_state->child_mapped = old_state->child_mapped;

memcpy(&(new_state->window_rect), &(old_state->window_rect), sizeof(Rect));
}

static void _x_con_kill(Con *con) {
con_state *state;

Expand Down