diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index e5a42db0..336163ea 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -521,7 +521,7 @@ static void render_titlebar(struct sway_output *output, | |||
521 | size_t inner_width = width - TITLEBAR_H_PADDING * 2; | 521 | size_t inner_width = width - TITLEBAR_H_PADDING * 2; |
522 | 522 | ||
523 | // Marks | 523 | // Marks |
524 | size_t marks_width = 0; | 524 | size_t marks_ob_width = 0; // output-buffer-local |
525 | if (config->show_marks && marks_texture) { | 525 | if (config->show_marks && marks_texture) { |
526 | struct wlr_box texture_box; | 526 | struct wlr_box texture_box; |
527 | wlr_texture_get_size(marks_texture, | 527 | wlr_texture_get_size(marks_texture, |
@@ -540,11 +540,23 @@ static void render_titlebar(struct sway_output *output, | |||
540 | } | 540 | } |
541 | render_texture(output->wlr_output, output_damage, marks_texture, | 541 | render_texture(output->wlr_output, output_damage, marks_texture, |
542 | &texture_box, matrix, con->alpha); | 542 | &texture_box, matrix, con->alpha); |
543 | marks_width = texture_box.width; | 543 | marks_ob_width = texture_box.width; |
544 | |||
545 | // Gap between the marks and bottom padding, for when the marks texture | ||
546 | // height is smaller than the config's font height | ||
547 | memcpy(&color, colors->background, sizeof(float) * 4); | ||
548 | premultiply_alpha(color, con->alpha); | ||
549 | box.x = texture_box.x; | ||
550 | box.y = texture_box.y + texture_box.height; | ||
551 | box.width = texture_box.width; | ||
552 | box.height = config->font_height * output_scale - texture_box.height; | ||
553 | if (box.height > 0) { | ||
554 | render_rect(output->wlr_output, output_damage, &box, color); | ||
555 | } | ||
544 | } | 556 | } |
545 | 557 | ||
546 | // Title text | 558 | // Title text |
547 | size_t title_width = 0; | 559 | size_t title_ob_width = 0; // output-buffer-local |
548 | if (title_texture) { | 560 | if (title_texture) { |
549 | struct wlr_box texture_box; | 561 | struct wlr_box texture_box; |
550 | wlr_texture_get_size(title_texture, | 562 | wlr_texture_get_size(title_texture, |
@@ -557,12 +569,24 @@ static void render_titlebar(struct sway_output *output, | |||
557 | WL_OUTPUT_TRANSFORM_NORMAL, | 569 | WL_OUTPUT_TRANSFORM_NORMAL, |
558 | 0.0, output->wlr_output->transform_matrix); | 570 | 0.0, output->wlr_output->transform_matrix); |
559 | 571 | ||
560 | if (inner_width * output_scale - marks_width < texture_box.width) { | 572 | if (inner_width * output_scale - marks_ob_width < texture_box.width) { |
561 | texture_box.width = inner_width * output_scale - marks_width; | 573 | texture_box.width = inner_width * output_scale - marks_ob_width; |
562 | } | 574 | } |
563 | render_texture(output->wlr_output, output_damage, title_texture, | 575 | render_texture(output->wlr_output, output_damage, title_texture, |
564 | &texture_box, matrix, con->alpha); | 576 | &texture_box, matrix, con->alpha); |
565 | title_width = texture_box.width; | 577 | title_ob_width = texture_box.width; |
578 | |||
579 | // Gap between the title and bottom padding, for when the title texture | ||
580 | // height is smaller than the config's font height | ||
581 | memcpy(&color, colors->background, sizeof(float) * 4); | ||
582 | premultiply_alpha(color, con->alpha); | ||
583 | box.x = texture_box.x; | ||
584 | box.y = texture_box.y + texture_box.height; | ||
585 | box.width = texture_box.width; | ||
586 | box.height = config->font_height * output_scale - texture_box.height; | ||
587 | if (box.height > 0) { | ||
588 | render_rect(output->wlr_output, output_damage, &box, color); | ||
589 | } | ||
566 | } | 590 | } |
567 | 591 | ||
568 | // Padding above title | 592 | // Padding above title |
@@ -580,9 +604,9 @@ static void render_titlebar(struct sway_output *output, | |||
580 | render_rect(output->wlr_output, output_damage, &box, color); | 604 | render_rect(output->wlr_output, output_damage, &box, color); |
581 | 605 | ||
582 | // Filler between title and marks | 606 | // Filler between title and marks |
583 | box.width = inner_width * output_scale - title_width - marks_width; | 607 | box.width = inner_width * output_scale - title_ob_width - marks_ob_width; |
584 | if (box.width > 0) { | 608 | if (box.width > 0) { |
585 | box.x = (x + TITLEBAR_H_PADDING) * output_scale + title_width; | 609 | box.x = (x + TITLEBAR_H_PADDING) * output_scale + title_ob_width; |
586 | box.y = (y + TITLEBAR_V_PADDING) * output_scale; | 610 | box.y = (y + TITLEBAR_V_PADDING) * output_scale; |
587 | box.height = config->font_height * output_scale; | 611 | box.height = config->font_height * output_scale; |
588 | render_rect(output->wlr_output, output_damage, &box, color); | 612 | render_rect(output->wlr_output, output_damage, &box, color); |