fix case where drawing border gets off by 1 pixel

This commit is contained in:
Dudemanguy911 2018-05-08 12:41:26 -05:00
parent 767640aa06
commit d97d662984

View file

@ -439,7 +439,7 @@ static void render_container_top_tabbed_border_normal(struct sway_output *output
wlr_backend_get_renderer(output->wlr_output->backend); wlr_backend_get_renderer(output->wlr_output->backend);
struct wlr_box box; struct wlr_box box;
float color[4]; float color[4];
size_t num_tabs = con->parent->children->length; float num_tabs = con->parent->children->length;
float tab_width = con->width / num_tabs; float tab_width = con->width / num_tabs;
// Single pixel bar above title // Single pixel bar above title
@ -447,7 +447,7 @@ static void render_container_top_tabbed_border_normal(struct sway_output *output
color[3] *= con->alpha; color[3] *= con->alpha;
box.x = con->x + depth * tab_width; box.x = con->x + depth * tab_width;
box.y = con->y; box.y = con->y;
box.width = con->width / num_tabs; box.width = con->width / num_tabs + 1;
box.height = 1; box.height = 1;
scale_box(&box, output->wlr_output->scale); scale_box(&box, output->wlr_output->scale);
wlr_render_rect(renderer, &box, color, wlr_render_rect(renderer, &box, color,
@ -456,7 +456,7 @@ static void render_container_top_tabbed_border_normal(struct sway_output *output
// Single pixel bar below title // Single pixel bar below title
box.x = con->x + depth*tab_width; box.x = con->x + depth*tab_width;
box.y = con->sway_view->y - 1; box.y = con->sway_view->y - 1;
box.width = con->width / num_tabs; box.width = con->width / num_tabs + 1;
box.height = 1; box.height = 1;
scale_box(&box, output->wlr_output->scale); scale_box(&box, output->wlr_output->scale);
wlr_render_rect(renderer, &box, color, wlr_render_rect(renderer, &box, color,
@ -485,7 +485,7 @@ static void render_container_top_tabbed_border_normal(struct sway_output *output
color[3] *= con->alpha; color[3] *= con->alpha;
box.x = con->x + con->sway_view->border_thickness + depth * tab_width; box.x = con->x + con->sway_view->border_thickness + depth * tab_width;
box.y = con->y + 1; box.y = con->y + 1;
box.width = con->width / num_tabs - con->sway_view->border_thickness * 2; box.width = con->width / num_tabs - con->sway_view->border_thickness * 2 + 1;
box.height = con->sway_view->y - con->y - 2; box.height = con->sway_view->y - con->y - 2;
scale_box(&box, output->wlr_output->scale); scale_box(&box, output->wlr_output->scale);
wlr_render_rect(renderer, &box, color, wlr_render_rect(renderer, &box, color,