summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-05 20:32:31 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-05 20:32:31 +1000
commite83e5487be4142af290e772199c2870d6140be46 (patch)
treed88f77c7ca8d54d8a64c3e713a05c6b9d18c59f7
parentMerge pull request #1912 from Hello71/patch-1 (diff)
downloadsway-e83e5487be4142af290e772199c2870d6140be46.tar.gz
sway-e83e5487be4142af290e772199c2870d6140be46.tar.zst
sway-e83e5487be4142af290e772199c2870d6140be46.zip
Use scissor to render title texture
This allows the title's texture to always be the full width of the text, and clipped at render time according to the desired width (eg. tabs...). As an added bonus, the texture no longer needs to be updated when containers are arranged.
-rw-r--r--sway/desktop/output.c8
-rw-r--r--sway/tree/arrange.c1
-rw-r--r--sway/tree/container.c6
3 files changed, 3 insertions, 12 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 03af4239..d17a6e14 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -308,12 +308,10 @@ static void render_container_simple_border_normal(struct sway_output *output,
308 308
309 // Title text 309 // Title text
310 if (title_texture) { 310 if (title_texture) {
311 double x = (con->x + con->sway_view->border_thickness) 311 wlr_renderer_scissor(renderer, &box);
312 * output->wlr_output->scale;
313 double y = (con->y + con->sway_view->border_thickness)
314 * output->wlr_output->scale;
315 wlr_render_texture(renderer, title_texture, 312 wlr_render_texture(renderer, title_texture,
316 output->wlr_output->transform_matrix, x, y, 1); 313 output->wlr_output->transform_matrix, box.x, box.y, 1);
314 wlr_renderer_scissor(renderer, NULL);
317 } 315 }
318} 316}
319 317
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index 1299beb6..83bb20fb 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -203,7 +203,6 @@ void arrange_children_of(struct sway_container *parent) {
203 } else { 203 } else {
204 arrange_children_of(child); 204 arrange_children_of(child);
205 } 205 }
206 container_update_title_textures(child);
207 } 206 }
208 container_damage_whole(parent); 207 container_damage_whole(parent);
209 update_debug_tree(); 208 update_debug_tree();
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 3746ad81..9fb47020 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -584,12 +584,6 @@ static void update_title_texture(struct sway_container *con,
584 get_text_size(c, config->font, &width, NULL, scale, false, "%s", con->name); 584 get_text_size(c, config->font, &width, NULL, scale, false, "%s", con->name);
585 cairo_destroy(c); 585 cairo_destroy(c);
586 586
587 int borders = (con->type == C_VIEW ? con->sway_view->border_thickness :
588 config->border_thickness) * 2 * scale;
589 if (width > con->width * scale - borders) {
590 width = con->width * scale - borders;
591 }
592
593 cairo_surface_t *surface = cairo_image_surface_create( 587 cairo_surface_t *surface = cairo_image_surface_create(
594 CAIRO_FORMAT_ARGB32, width, height); 588 CAIRO_FORMAT_ARGB32, width, height);
595 cairo_t *cairo = cairo_create(surface); 589 cairo_t *cairo = cairo_create(surface);