Fix issues @orestisf1993 raised

This commit is contained in:
Drew DeVault 2018-04-06 12:46:33 -04:00
parent b5baa78dc3
commit cd6e3182fa
2 changed files with 57 additions and 49 deletions

View File

@ -34,12 +34,12 @@ static int draw_container(cairo_t *cairo, struct sway_container *container,
struct sway_container *focus, int x, int y) { struct sway_container *focus, int x, int y) {
int text_width, text_height; int text_width, text_height;
get_text_size(cairo, "monospace", &text_width, &text_height, get_text_size(cairo, "monospace", &text_width, &text_height,
1, false, "%s '%s' %s %dx%d@%d,%d", 1, false, "%s id:%zd '%s' %s %dx%d@%d,%d",
container_type_to_str(container->type), container->name, container_type_to_str(container->type), container->id, container->name,
layout_to_str(container->layout), layout_to_str(container->layout),
container->width, container->height, container->x, container->y); container->width, container->height, container->x, container->y);
cairo_rectangle(cairo, x, y, text_width, text_height); cairo_rectangle(cairo, x, y, text_width, text_height);
cairo_set_source_u32(cairo, 0xFFFFFFFF); cairo_set_source_u32(cairo, 0xFFFFFFE0);
cairo_fill(cairo); cairo_fill(cairo);
cairo_move_to(cairo, x, y); cairo_move_to(cairo, x, y);
if (focus == container) { if (focus == container) {
@ -47,8 +47,8 @@ static int draw_container(cairo_t *cairo, struct sway_container *container,
} else { } else {
cairo_set_source_u32(cairo, 0x000000FF); cairo_set_source_u32(cairo, 0x000000FF);
} }
pango_printf(cairo, "monospace", 1, false, "%s '%s' %s %dx%d@%d,%d", pango_printf(cairo, "monospace", 1, false, "%s id:%zd '%s' %s %dx%d@%d,%d",
container_type_to_str(container->type), container->name, container_type_to_str(container->type), container->id, container->name,
layout_to_str(container->layout), layout_to_str(container->layout),
container->width, container->height, container->x, container->y); container->width, container->height, container->x, container->y);
int height = text_height; int height = text_height;

View File

@ -381,6 +381,7 @@ void container_move(struct sway_container *container,
int index = index_child(container); int index = index_child(container);
struct sway_container *old_parent = container->parent; struct sway_container *old_parent = container->parent;
while (sibling) {
switch (sibling->type) { switch (sibling->type) {
case C_VIEW: case C_VIEW:
if (sibling->parent == container->parent) { if (sibling->parent == container->parent) {
@ -396,6 +397,7 @@ void container_move(struct sway_container *container,
arrange_windows(sibling->parent, -1, -1); arrange_windows(sibling->parent, -1, -1);
arrange_windows(old_parent, -1, -1); arrange_windows(old_parent, -1, -1);
} }
sibling = NULL;
break; break;
case C_WORKSPACE: // Note: only in the case of moving between outputs case C_WORKSPACE: // Note: only in the case of moving between outputs
case C_CONTAINER: case C_CONTAINER:
@ -407,13 +409,17 @@ void container_move(struct sway_container *container,
container->width = container->height = 0; container->width = container->height = 0;
arrange_windows(sibling, -1, -1); arrange_windows(sibling, -1, -1);
arrange_windows(old_parent, -1, -1); arrange_windows(old_parent, -1, -1);
sibling = NULL;
} else { } else {
wlr_log(L_DEBUG, "Reparenting container (perpendicular)"); wlr_log(L_DEBUG, "Reparenting container (perpendicular)");
container_remove_child(container); container_remove_child(container);
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);
wlr_log(L_DEBUG, "Focus inactive: %zd", focus_inactive ?
focus_inactive->id : 0);
if (focus_inactive) { if (focus_inactive) {
container_add_sibling(focus_inactive, container); sibling = focus_inactive;
continue;
} else if (sibling->children->length) { } else if (sibling->children->length) {
container_add_sibling(sibling->children->items[0], container); container_add_sibling(sibling->children->items[0], container);
} else { } else {
@ -422,6 +428,7 @@ void container_move(struct sway_container *container,
container->width = container->height = 0; container->width = container->height = 0;
arrange_windows(sibling, -1, -1); arrange_windows(sibling, -1, -1);
arrange_windows(old_parent, -1, -1); arrange_windows(old_parent, -1, -1);
sibling = NULL;
} }
break; break;
default: default:
@ -429,6 +436,7 @@ void container_move(struct sway_container *container,
container_type_to_str(sibling->type)); container_type_to_str(sibling->type));
return; return;
} }
}
if (old_parent) { if (old_parent) {
seat_set_focus(config->handler_context.seat, old_parent); seat_set_focus(config->handler_context.seat, old_parent);