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) {
int text_width, text_height;
get_text_size(cairo, "monospace", &text_width, &text_height,
1, false, "%s '%s' %s %dx%d@%d,%d",
container_type_to_str(container->type), container->name,
1, false, "%s id:%zd '%s' %s %dx%d@%d,%d",
container_type_to_str(container->type), container->id, container->name,
layout_to_str(container->layout),
container->width, container->height, container->x, container->y);
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_move_to(cairo, x, y);
if (focus == container) {
@ -47,8 +47,8 @@ static int draw_container(cairo_t *cairo, struct sway_container *container,
} else {
cairo_set_source_u32(cairo, 0x000000FF);
}
pango_printf(cairo, "monospace", 1, false, "%s '%s' %s %dx%d@%d,%d",
container_type_to_str(container->type), container->name,
pango_printf(cairo, "monospace", 1, false, "%s id:%zd '%s' %s %dx%d@%d,%d",
container_type_to_str(container->type), container->id, container->name,
layout_to_str(container->layout),
container->width, container->height, container->x, container->y);
int height = text_height;

View file

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