mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-02-16 22:05:25 -05:00
add stack_proportion
This commit is contained in:
parent
02690694d8
commit
9adb80d29f
3 changed files with 53 additions and 8 deletions
|
|
@ -224,17 +224,39 @@ void arrange_stack(Client *scroller_stack_head, struct wlr_box geometry,
|
|||
if (stack_size == 0)
|
||||
return;
|
||||
|
||||
int32_t client_height =
|
||||
(geometry.height - (stack_size - 1) * gappiv) / stack_size;
|
||||
int32_t current_y = geometry.y;
|
||||
float total_proportion = 0.0f;
|
||||
iter = scroller_stack_head;
|
||||
while (iter) {
|
||||
if(iter->stack_proportion <= 0.0f || iter->stack_proportion >= 1.0f) {
|
||||
iter->stack_proportion = stack_size == 1 ? 1.0f : 1.0f/(stack_size - 1);
|
||||
}
|
||||
total_proportion += iter->stack_proportion;
|
||||
iter = iter->next_in_stack;
|
||||
}
|
||||
|
||||
iter = scroller_stack_head;
|
||||
while (iter) {
|
||||
iter->stack_proportion = iter->stack_proportion / total_proportion;
|
||||
iter = iter->next_in_stack;
|
||||
}
|
||||
|
||||
int32_t client_height;
|
||||
int32_t current_y = geometry.y;
|
||||
int32_t remain_client_height = geometry.height - (stack_size - 1) * gappiv;
|
||||
float remain_proportion = 1.0f;
|
||||
|
||||
iter = scroller_stack_head;
|
||||
while (iter) {
|
||||
|
||||
client_height = remain_client_height * (iter->stack_proportion / remain_proportion);
|
||||
|
||||
struct wlr_box client_geom = {.x = geometry.x,
|
||||
.y = current_y,
|
||||
.width = geometry.width,
|
||||
.height = client_height};
|
||||
resize(iter, client_geom, 0);
|
||||
remain_proportion -= iter->stack_proportion;
|
||||
remain_client_height -= client_height;
|
||||
current_y += client_height + gappiv;
|
||||
iter = iter->next_in_stack;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,8 +199,8 @@ void vertical_scroll_adjust_fullandmax(Client *c, struct wlr_box *target_geom) {
|
|||
target_geom->x = m->w.x + (m->w.width - target_geom->width) / 2;
|
||||
}
|
||||
|
||||
void arrange_stack_vertical(Client *scroller_stack_head,
|
||||
struct wlr_box geometry, int32_t gappih) {
|
||||
void arrange_stack_vertical(Client *scroller_stack_head, struct wlr_box geometry,
|
||||
int32_t gappih) {
|
||||
int32_t stack_size = 0;
|
||||
Client *iter = scroller_stack_head;
|
||||
while (iter) {
|
||||
|
|
@ -211,17 +211,39 @@ void arrange_stack_vertical(Client *scroller_stack_head,
|
|||
if (stack_size == 0)
|
||||
return;
|
||||
|
||||
int32_t client_width =
|
||||
(geometry.width - (stack_size - 1) * gappih) / stack_size;
|
||||
int32_t current_x = geometry.x;
|
||||
float total_proportion = 0.0f;
|
||||
iter = scroller_stack_head;
|
||||
while (iter) {
|
||||
if(iter->stack_proportion <= 0.0f || iter->stack_proportion >= 1.0f) {
|
||||
iter->stack_proportion = stack_size == 1 ? 1.0f : 1.0f/(stack_size - 1);
|
||||
}
|
||||
total_proportion += iter->stack_proportion;
|
||||
iter = iter->next_in_stack;
|
||||
}
|
||||
|
||||
iter = scroller_stack_head;
|
||||
while (iter) {
|
||||
iter->stack_proportion = iter->stack_proportion / total_proportion;
|
||||
iter = iter->next_in_stack;
|
||||
}
|
||||
|
||||
int32_t client_width;
|
||||
int32_t current_x = geometry.x;
|
||||
int32_t remain_client_width = geometry.width - (stack_size - 1) * gappih;
|
||||
float remain_proportion = 1.0f;
|
||||
|
||||
iter = scroller_stack_head;
|
||||
while (iter) {
|
||||
|
||||
client_width = remain_client_width * (iter->stack_proportion / remain_proportion);
|
||||
|
||||
struct wlr_box client_geom = {.y = geometry.y,
|
||||
.x = current_x,
|
||||
.height = geometry.height,
|
||||
.width = client_width};
|
||||
resize(iter, client_geom, 0);
|
||||
remain_proportion -= iter->stack_proportion;
|
||||
remain_client_width -= client_width;
|
||||
current_x += client_width + gappih;
|
||||
iter = iter->next_in_stack;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -375,6 +375,7 @@ struct Client {
|
|||
bool is_pending_open_animation;
|
||||
bool is_restoring_from_ov;
|
||||
float scroller_proportion;
|
||||
float stack_proportion;
|
||||
bool need_output_flush;
|
||||
struct dwl_animation animation;
|
||||
struct dwl_opacity_animation opacity_animation;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue