add variable main stack size
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@
|
|||||||
static const float focused_border_color[4] = {0.88, 0.18, 0.18, 1.0};
|
static const float focused_border_color[4] = {0.88, 0.18, 0.18, 1.0};
|
||||||
static const float unfocused_border_color[4] = {0.18, 0.18, 0.18, 1.0};
|
static const float unfocused_border_color[4] = {0.18, 0.18, 0.18, 1.0};
|
||||||
|
|
||||||
#define ABSINTHE_MAIN_TOPLEVEL_WIDTH 0.5
|
#define ABSINTHE_MAIN_STACK_WIDTH 0.5
|
||||||
|
#define ABSINTHE_MAIN_STACK_SIZE 2
|
||||||
|
|
||||||
#define ABSINTHE_OUTPUT_GAP 10
|
#define ABSINTHE_OUTPUT_GAP 10
|
||||||
#define ABSINTHE_LAYOUT_GAP 10
|
#define ABSINTHE_LAYOUT_GAP 10
|
||||||
|
|||||||
+31
-9
@@ -12,7 +12,6 @@ void layout_arrange(struct absinthe_output *output)
|
|||||||
toplevels_count++;
|
toplevels_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (toplevels_count < 1)
|
if (toplevels_count < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -34,24 +33,47 @@ void layout_arrange(struct absinthe_output *output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t layout_gap = ABSINTHE_LAYOUT_GAP;
|
int32_t layout_gap = ABSINTHE_LAYOUT_GAP;
|
||||||
int32_t main_toplevel_width = ABSINTHE_MAIN_TOPLEVEL_WIDTH * (output->geometry.width - 2 * output_gap);
|
int32_t main_stack_width = (toplevels_count <= ABSINTHE_MAIN_STACK_SIZE)
|
||||||
int32_t width, height;
|
? output->geometry.width - borders_width - 2 * output_gap
|
||||||
width = output->geometry.width - main_toplevel_width - borders_width - layout_gap - 2 * output_gap;
|
: ABSINTHE_MAIN_STACK_WIDTH * (output->geometry.width - 2 * output_gap);
|
||||||
|
int32_t width = output->geometry.width - main_stack_width - borders_width - layout_gap - 2 * output_gap;
|
||||||
|
int32_t height;
|
||||||
int32_t dy = output_gap;
|
int32_t dy = output_gap;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
|
if (toplevels_count <= ABSINTHE_MAIN_STACK_SIZE) {
|
||||||
wl_list_for_each(toplevel, &output->server->toplevels, link) {
|
wl_list_for_each(toplevel, &output->server->toplevels, link) {
|
||||||
if (toplevel->output != output)
|
if (toplevel->output != output)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i == 0) {
|
height = (output->geometry.height - dy - output_gap) / (ABSINTHE_MAIN_STACK_SIZE - i) - borders_width;
|
||||||
height = output->geometry.height - borders_width - 2 * output_gap;
|
wlr_xdg_toplevel_set_size(toplevel->toplevel.xdg, main_stack_width, height);
|
||||||
wlr_xdg_toplevel_set_size(toplevel->toplevel.xdg, main_toplevel_width, height);
|
|
||||||
toplevel->geometry.x = output->geometry.x + output_gap;
|
toplevel->geometry.x = output->geometry.x + output_gap;
|
||||||
toplevel->geometry.y = output->geometry.y + output_gap;
|
toplevel->geometry.y = output->geometry.y + dy;
|
||||||
|
dy += height + borders_width + layout_gap;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wl_list_for_each(toplevel, &output->server->toplevels, link) {
|
||||||
|
if (toplevel->output != output)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
if (i < ABSINTHE_MAIN_STACK_SIZE) {
|
||||||
|
height = (output->geometry.height - dy - output_gap) / (ABSINTHE_MAIN_STACK_SIZE - i) - borders_width;
|
||||||
|
wlr_xdg_toplevel_set_size(toplevel->toplevel.xdg, main_stack_width, height);
|
||||||
|
toplevel->geometry.x = output->geometry.x + output_gap;
|
||||||
|
toplevel->geometry.y = output->geometry.y + dy;
|
||||||
|
dy += height + borders_width + layout_gap;
|
||||||
} else {
|
} else {
|
||||||
|
if (i == ABSINTHE_MAIN_STACK_SIZE)
|
||||||
|
dy = output_gap;
|
||||||
height = (output->geometry.height - dy - output_gap) / (toplevels_count - i) - borders_width;
|
height = (output->geometry.height - dy - output_gap) / (toplevels_count - i) - borders_width;
|
||||||
wlr_xdg_toplevel_set_size(toplevel->toplevel.xdg, width, height);
|
wlr_xdg_toplevel_set_size(toplevel->toplevel.xdg, width, height);
|
||||||
toplevel->geometry.x = output->geometry.x + main_toplevel_width + layout_gap + output_gap;
|
toplevel->geometry.x = output->geometry.x + main_stack_width + layout_gap + output_gap;
|
||||||
toplevel->geometry.y = output->geometry.y + dy;
|
toplevel->geometry.y = output->geometry.y + dy;
|
||||||
dy += height + borders_width + layout_gap;
|
dy += height + borders_width + layout_gap;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user