fixing borders
This commit is contained in:
+2
-2
@@ -13,5 +13,5 @@ static const float unfocused_border_color[4] = {0.39, 0.42, 0.46, 1.0};
|
||||
#define ABSINTHE_MAIN_STACK_SIZE 1;
|
||||
#define ABSINTHE_MAIN_STACK_WIDTH 0.5;
|
||||
|
||||
#define ABSINTHE_OUTPUT_GAP 10
|
||||
#define ABSINTHE_LAYOUT_GAP 10
|
||||
#define ABSINTHE_OUTPUT_GAP 0
|
||||
#define ABSINTHE_LAYOUT_GAP 0
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void run_command();
|
||||
@@ -74,10 +74,9 @@ void absinthe_toplevel_map(struct wl_listener *listener, void *data)
|
||||
toplevel->scene_surface->node.data = toplevel;
|
||||
|
||||
absinthe_toplevel_update_geometry(toplevel);
|
||||
toplevel->border_width = ABSINTHE_TOPLEVEL_BORDER_WIDTH;
|
||||
int32_t borders_width = ABSINTHE_TOPLEVEL_BORDER_WIDTH * 2;
|
||||
toplevel->geometry.width += borders_width;
|
||||
toplevel->geometry.height += borders_width;
|
||||
toplevel->border_width = absinthe_toplevel_is_unmanaged(toplevel)
|
||||
? 0
|
||||
: ABSINTHE_TOPLEVEL_BORDER_WIDTH;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
toplevel->border[i] = wlr_scene_rect_create(toplevel->scene_tree, 0, 0, unfocused_border_color);
|
||||
@@ -204,13 +203,14 @@ void absinthe_toplevel_set_size(struct absinthe_toplevel *toplevel, int32_t widt
|
||||
if (width < 0 || height < 0)
|
||||
return;
|
||||
if (toplevel->type == ABSINTHE_TOPLEVEL_XDG) {
|
||||
toplevel->resizing = wlr_xdg_toplevel_set_size(toplevel->toplevel.xdg, width, height);
|
||||
toplevel->resizing = wlr_xdg_toplevel_set_size(toplevel->toplevel.xdg, width - 2 * toplevel->border_width, height - 2 * toplevel->border_width);
|
||||
}
|
||||
#ifdef XWAYLAND
|
||||
else if (toplevel->type == ABSINTHE_TOPLEVEL_X11) {
|
||||
wlr_xwayland_surface_configure(toplevel->toplevel.x11,
|
||||
toplevel->geometry.x, toplevel->geometry.y, width, height);
|
||||
toplevel->geometry.x, toplevel->geometry.y, width - 2 * toplevel->border_width, height - 2 * toplevel->border_width);
|
||||
absinthe_toplevel_set_position(toplevel, toplevel->geometry.x, toplevel->geometry.y);
|
||||
absinthe_toplevel_update_borders_geometry(toplevel);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -231,7 +231,9 @@ void absinthe_toplevel_set_fullscreen(struct absinthe_toplevel *toplevel, bool f
|
||||
absinthe_toplevel_set_size(toplevel, toplevel->geometry.width, toplevel->geometry.height);
|
||||
} else {
|
||||
toplevel->geometry = toplevel->prev_geometry;
|
||||
toplevel->border_width = ABSINTHE_TOPLEVEL_BORDER_WIDTH;
|
||||
toplevel->border_width = absinthe_toplevel_is_unmanaged(toplevel)
|
||||
? 0
|
||||
: ABSINTHE_TOPLEVEL_BORDER_WIDTH;
|
||||
absinthe_toplevel_set_size(toplevel, toplevel->geometry.width, toplevel->geometry.height);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-13
@@ -18,7 +18,6 @@ void layout_arrange(struct absinthe_output *output)
|
||||
if (toplevels_count < 1)
|
||||
return;
|
||||
|
||||
int32_t borders_width = ABSINTHE_TOPLEVEL_BORDER_WIDTH * 2;
|
||||
int32_t output_gap = ABSINTHE_OUTPUT_GAP;
|
||||
|
||||
if (toplevels_count == 1) {
|
||||
@@ -26,20 +25,19 @@ void layout_arrange(struct absinthe_output *output)
|
||||
if (toplevel->output == output)
|
||||
break;
|
||||
}
|
||||
|
||||
toplevel->geometry.x = output->geometry.x + output_gap;
|
||||
toplevel->geometry.y = output->geometry.y + output_gap;
|
||||
absinthe_toplevel_set_size(toplevel,
|
||||
output->geometry.width - borders_width - 2 * output_gap,
|
||||
output->geometry.height - borders_width - 2 * output_gap);
|
||||
output->geometry.width - 2 * output_gap,
|
||||
output->geometry.height - 2 * output_gap);
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t layout_gap = ABSINTHE_LAYOUT_GAP;
|
||||
int32_t main_stack_width = (toplevels_count <= output->main_stack_size)
|
||||
? output->geometry.width - borders_width - 2 * output_gap
|
||||
? output->geometry.width - 2 * output_gap
|
||||
: output->main_stack_width * (output->geometry.width - 2 * output_gap);
|
||||
int32_t width = output->geometry.width - main_stack_width - borders_width - 2 * output_gap - layout_gap;
|
||||
int32_t width = output->geometry.width - main_stack_width - 2 * output_gap - layout_gap;
|
||||
int32_t height;
|
||||
int32_t dy = output_gap;
|
||||
size_t i = 0;
|
||||
@@ -49,11 +47,11 @@ void layout_arrange(struct absinthe_output *output)
|
||||
if (toplevel->output != output || !toplevel->tiled)
|
||||
continue;
|
||||
|
||||
height = (output->geometry.height - dy - output_gap) / (output->main_stack_size - i) - borders_width;
|
||||
height = (output->geometry.height - dy - output_gap) / (toplevels_count - i);
|
||||
toplevel->geometry.x = output->geometry.x + output_gap;
|
||||
toplevel->geometry.y = output->geometry.y + dy;
|
||||
absinthe_toplevel_set_size(toplevel, main_stack_width, height);
|
||||
dy += height + borders_width + layout_gap;
|
||||
dy += height + layout_gap;
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -64,21 +62,20 @@ void layout_arrange(struct absinthe_output *output)
|
||||
if (toplevel->output != output || !toplevel->tiled)
|
||||
continue;
|
||||
|
||||
|
||||
if (i < output->main_stack_size) {
|
||||
height = (output->geometry.height - dy - output_gap) / (output->main_stack_size - i) - borders_width;
|
||||
height = (output->geometry.height - dy - output_gap) / (output->main_stack_size - i);
|
||||
toplevel->geometry.x = output->geometry.x + output_gap;
|
||||
toplevel->geometry.y = output->geometry.y + dy;
|
||||
absinthe_toplevel_set_size(toplevel, main_stack_width, height);
|
||||
dy += height + borders_width + layout_gap;
|
||||
dy += height + layout_gap;
|
||||
} else {
|
||||
if (i == output->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);
|
||||
toplevel->geometry.x = output->geometry.x + main_stack_width + layout_gap + output_gap;
|
||||
toplevel->geometry.y = output->geometry.y + dy;
|
||||
absinthe_toplevel_set_size(toplevel, width, height);
|
||||
dy += height + borders_width + layout_gap;
|
||||
dy += height + layout_gap;
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
@@ -153,6 +153,9 @@ void server_xwayland_new_surface(struct wl_listener *listener, void *data)
|
||||
toplevel->type = ABSINTHE_TOPLEVEL_X11;
|
||||
toplevel->server = server;
|
||||
toplevel->toplevel.x11 = surface;
|
||||
toplevel->border_width = absinthe_toplevel_is_unmanaged(toplevel)
|
||||
? 0
|
||||
: ABSINTHE_TOPLEVEL_BORDER_WIDTH;
|
||||
|
||||
toplevel->destroy.notify = absinthe_toplevel_destroy;
|
||||
wl_signal_add(&surface->events.destroy, &toplevel->destroy);
|
||||
|
||||
Reference in New Issue
Block a user