Added nixpup MangoWC build features.

This commit is contained in:
nixpup 2026-01-16 18:49:35 +01:00
parent bc1f310e1c
commit c0abfaefc8
19 changed files with 324 additions and 491 deletions

View file

@ -627,7 +627,7 @@ arrange(Monitor *m, bool want_animation, bool from_view) {
m->visible_tiling_clients++;
}
if (ISSCROLLTILED(c)) {
if (ISSCROLLTILED(c) && !c->prev_in_stack) {
m->visible_scroll_tiling_clients++;
}
}

View file

@ -212,6 +212,33 @@ void horizontal_scroll_adjust_fullandmax(Client *c,
target_geom->y = m->w.y + (m->w.height - target_geom->height) / 2;
}
void arrange_stack(Client *stack_head, struct wlr_box geometry, int32_t gappiv) {
int32_t stack_size = 0;
Client *iter = stack_head;
while (iter) {
stack_size++;
iter = iter->next_in_stack;
}
if (stack_size == 0) return;
int32_t client_height = (geometry.height - (stack_size - 1) * gappiv) / stack_size;
int32_t current_y = geometry.y;
iter = stack_head;
while (iter) {
struct wlr_box client_geom = {
.x = geometry.x,
.y = current_y,
.width = geometry.width,
.height = client_height
};
resize(iter, client_geom, 0);
current_y += client_height + gappiv;
iter = iter->next_in_stack;
}
}
// 滚动布局
void scroller(Monitor *m) {
int32_t i, n, j;
@ -225,6 +252,8 @@ void scroller(Monitor *m) {
int32_t cur_gappih = enablegaps ? m->gappih : 0;
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
int32_t cur_gappov = enablegaps ? m->gappov : 0;
int32_t cur_gappiv = enablegaps ? m->gappiv : 0;
cur_gappih =
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
@ -251,7 +280,7 @@ void scroller(Monitor *m) {
// 第二次遍历,填充 tempClients
j = 0;
wl_list_for_each(c, &clients, link) {
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
if (VISIBLEON(c, m) && ISSCROLLTILED(c) && !c->prev_in_stack) {
tempClients[j] = c;
j++;
}
@ -269,7 +298,7 @@ void scroller(Monitor *m) {
target_geom.width = (m->w.width - 2 * cur_gappoh) * single_proportion;
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
resize(c, target_geom, 0);
arrange_stack(c, target_geom, cur_gappiv);
free(tempClients); // 释放内存
return;
}
@ -283,6 +312,14 @@ void scroller(Monitor *m) {
root_client = center_tiled_select(m);
}
// root_client might be in a stack, find the stack head
if (root_client) {
while(root_client->prev_in_stack) {
root_client = root_client->prev_in_stack;
}
}
if (!root_client) {
free(tempClients); // 释放内存
return;
@ -317,10 +354,10 @@ void scroller(Monitor *m) {
&target_geom);
if (tempClients[focus_client_index]->isfullscreen) {
target_geom.x = m->m.x;
resize(tempClients[focus_client_index], target_geom, 0);
arrange_stack(tempClients[focus_client_index], target_geom, cur_gappiv);
} else if (tempClients[focus_client_index]->ismaximizescreen) {
target_geom.x = m->w.x + cur_gappoh;
resize(tempClients[focus_client_index], target_geom, 0);
arrange_stack(tempClients[focus_client_index], target_geom, cur_gappiv);
} else if (need_scroller) {
if (scroller_focus_center ||
((!m->prevsel ||
@ -338,10 +375,10 @@ void scroller(Monitor *m) {
scroller_structs)
: m->w.x + scroller_structs;
}
resize(tempClients[focus_client_index], target_geom, 0);
arrange_stack(tempClients[focus_client_index], target_geom, cur_gappiv);
} else {
target_geom.x = c->geom.x;
resize(tempClients[focus_client_index], target_geom, 0);
arrange_stack(tempClients[focus_client_index], target_geom, cur_gappiv);
}
for (i = 1; i <= focus_client_index; i++) {
@ -351,7 +388,7 @@ void scroller(Monitor *m) {
target_geom.x = tempClients[focus_client_index - i + 1]->geom.x -
cur_gappih - target_geom.width;
resize(c, target_geom, 0);
arrange_stack(c, target_geom, cur_gappiv);
}
for (i = 1; i < n - focus_client_index; i++) {
@ -361,7 +398,7 @@ void scroller(Monitor *m) {
target_geom.x = tempClients[focus_client_index + i - 1]->geom.x +
cur_gappih +
tempClients[focus_client_index + i - 1]->geom.width;
resize(c, target_geom, 0);
arrange_stack(c, target_geom, cur_gappiv);
}
free(tempClients); // 最后释放内存