Fix movement crashes/issues

This commit is contained in:
Brian Ashworth 2018-06-05 01:13:27 -04:00
parent 0549fd027b
commit 9aaac8b8c8

View file

@ -412,19 +412,15 @@ void container_move(struct sway_container *container,
} }
case C_WORKSPACE: case C_WORKSPACE:
if (!is_parallel(current->layout, move_dir)) { if (!is_parallel(current->layout, move_dir)) {
if (current->children->length > 2) { if (current->children->length >= 2) {
wlr_log(L_DEBUG, "Rejiggering the workspace (%d kiddos)", wlr_log(L_DEBUG, "Rejiggering the workspace (%d kiddos)",
current->children->length); current->children->length);
workspace_rejigger(current, container, move_dir); workspace_rejigger(current, container, move_dir);
} else if (current->children->length == 2) { return;
wlr_log(L_DEBUG, "Changing workspace layout"); } else {
current->layout = wlr_log(L_DEBUG, "Selecting output");
move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? current = current->parent;
L_HORIZ : L_VERT;
container_insert_child(current, container, offs < 0 ? 0 : 1);
arrange_workspace(current);
} }
return;
} else if (current->layout == L_TABBED } else if (current->layout == L_TABBED
|| current->layout == L_STACKED) { || current->layout == L_STACKED) {
wlr_log(L_DEBUG, "Rejiggering out of tabs/stacks"); wlr_log(L_DEBUG, "Rejiggering out of tabs/stacks");
@ -520,7 +516,7 @@ void container_move(struct sway_container *container,
wlr_log(L_DEBUG, "Reparenting container (perpendicular)"); wlr_log(L_DEBUG, "Reparenting container (perpendicular)");
struct sway_container *focus_inactive = seat_get_focus_inactive( struct sway_container *focus_inactive = seat_get_focus_inactive(
config->handler_context.seat, sibling); config->handler_context.seat, sibling);
if (focus_inactive) { if (focus_inactive && focus_inactive != sibling) {
while (focus_inactive->parent != sibling) { while (focus_inactive->parent != sibling) {
focus_inactive = focus_inactive->parent; focus_inactive = focus_inactive->parent;
} }