aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ian Huang <imyxh@protonmail.com>2020-04-19 17:56:11 -0700
committerLibravatar Simon Ser <contact@emersion.fr>2020-04-20 09:26:37 +0200
commit276e0301e0d68cc799a7073d26a7a10c11d036ff (patch)
tree9c14a3c5a87e2d89fb9b5949760ecf3d1f4b29a2
parentDon't transfer focus to NULL node on touch (diff)
downloadsway-276e0301e0d68cc799a7073d26a7a10c11d036ff.tar.gz
sway-276e0301e0d68cc799a7073d26a7a10c11d036ff.tar.zst
sway-276e0301e0d68cc799a7073d26a7a10c11d036ff.zip
interpret "subpixel none" as CAIRO_ANTIALIAS_GRAY
See issue #5228. Currently, WL_OUTPUT_SUBPIXEL_NONE is ignored and CAIRO_ANTIALIAS_SUBPIXEL is still set. This commit checks if subpixel is set to none and if so, calls set_antialias with CAIRO_ANTIALIAS_GRAY. This mirrors the functionality in Mako's [PR261](https://github.com/emersion/mako/pull/261)
-rw-r--r--sway/tree/container.c9
-rw-r--r--swaybar/render.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 0c40af0a..d6c9a945 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -459,8 +459,13 @@ static void update_title_texture(struct sway_container *con,
459 cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST); 459 cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST);
460 cairo_font_options_t *fo = cairo_font_options_create(); 460 cairo_font_options_t *fo = cairo_font_options_create();
461 cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL); 461 cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL);
462 cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL); 462 if (output->wlr_output->subpixel == WL_OUTPUT_SUBPIXEL_NONE) {
463 cairo_font_options_set_subpixel_order(fo, to_cairo_subpixel_order(output->wlr_output->subpixel)); 463 cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_GRAY);
464 } else {
465 cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL);
466 cairo_font_options_set_subpixel_order(fo,
467 to_cairo_subpixel_order(output->wlr_output->subpixel));
468 }
464 cairo_set_font_options(c, fo); 469 cairo_set_font_options(c, fo);
465 get_text_size(c, config->font, &width, NULL, NULL, scale, 470 get_text_size(c, config->font, &width, NULL, NULL, scale,
466 config->pango_markup, "%s", con->formatted_title); 471 config->pango_markup, "%s", con->formatted_title);
diff --git a/swaybar/render.c b/swaybar/render.c
index ea5faef6..3a626e1c 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -698,8 +698,13 @@ void render_frame(struct swaybar_output *output) {
698 cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST); 698 cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
699 cairo_font_options_t *fo = cairo_font_options_create(); 699 cairo_font_options_t *fo = cairo_font_options_create();
700 cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL); 700 cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL);
701 cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL); 701 if (output->subpixel == WL_OUTPUT_SUBPIXEL_NONE) {
702 cairo_font_options_set_subpixel_order(fo, to_cairo_subpixel_order(output->subpixel)); 702 cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_GRAY);
703 } else {
704 cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL);
705 cairo_font_options_set_subpixel_order(fo,
706 to_cairo_subpixel_order(output->subpixel));
707 }
703 cairo_set_font_options(cairo, fo); 708 cairo_set_font_options(cairo, fo);
704 cairo_font_options_destroy(fo); 709 cairo_font_options_destroy(fo);
705 cairo_save(cairo); 710 cairo_save(cairo);