|
|
@ -177,29 +177,24 @@ static void apply_vert_layout(struct sway_container *parent) {
|
|
|
|
child->height = parent->y + parent_offset + parent_height - child->y;
|
|
|
|
child->height = parent->y + parent_offset + parent_height - child->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void apply_tabbed_layout(struct sway_container *parent) {
|
|
|
|
static void apply_tabbed_or_stacked_layout(struct sway_container *parent) {
|
|
|
|
if (!parent->children->length) {
|
|
|
|
if (!parent->children->length) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < parent->children->length; ++i) {
|
|
|
|
size_t parent_offset = 0;
|
|
|
|
struct sway_container *child = parent->children->items[i];
|
|
|
|
if (parent->parent->layout == L_TABBED) {
|
|
|
|
child->x = parent->x;
|
|
|
|
parent_offset = container_titlebar_height();
|
|
|
|
child->y = parent->y;
|
|
|
|
} else if (parent->parent->layout == L_STACKED) {
|
|
|
|
child->width = parent->width;
|
|
|
|
parent_offset =
|
|
|
|
child->height = parent->height;
|
|
|
|
container_titlebar_height() * parent->parent->children->length;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void apply_stacked_layout(struct sway_container *parent) {
|
|
|
|
|
|
|
|
if (!parent->children->length) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t parent_height = parent->height - parent_offset;
|
|
|
|
for (int i = 0; i < parent->children->length; ++i) {
|
|
|
|
for (int i = 0; i < parent->children->length; ++i) {
|
|
|
|
struct sway_container *child = parent->children->items[i];
|
|
|
|
struct sway_container *child = parent->children->items[i];
|
|
|
|
child->x = parent->x;
|
|
|
|
child->x = parent->x;
|
|
|
|
child->y = parent->y;
|
|
|
|
child->y = parent->y + parent_offset;
|
|
|
|
child->width = parent->width;
|
|
|
|
child->width = parent->width;
|
|
|
|
child->height = parent->height;
|
|
|
|
child->height = parent_height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -234,10 +229,8 @@ void arrange_children_of(struct sway_container *parent) {
|
|
|
|
apply_vert_layout(parent);
|
|
|
|
apply_vert_layout(parent);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case L_TABBED:
|
|
|
|
case L_TABBED:
|
|
|
|
apply_tabbed_layout(parent);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case L_STACKED:
|
|
|
|
case L_STACKED:
|
|
|
|
apply_stacked_layout(parent);
|
|
|
|
apply_tabbed_or_stacked_layout(parent);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
wlr_log(L_DEBUG, "TODO: arrange layout type %d", parent->layout);
|
|
|
|
wlr_log(L_DEBUG, "TODO: arrange layout type %d", parent->layout);
|
|
|
|