Skip to content
Myr

wayland: set renderer's subpixel from 'current' monitor

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This fixes a regression where the subpixel mode wasn't propagated to the renderer, which thus rendered everything using grayscale antialiasing.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 0369bd6 · Browse files · 4 files+23 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+23 added−15 removed

  • other:+23 added−15 removed

4 files+23 added−15 removed

modified:CHANGELOG.md+6 added
modified:render.c+7 added-6 removed
126 unmodified lines
127128 const wchar_t *ptext = prompt_text(prompt);129 const size_t text_len = wcslen(ptext);130131 const bool subpixel_antialias =132 render->options.background_color.a == 1. &&133 render->options.selection_color.a == 1.;131 const enum fcft_subpixel subpixel =132 (render->options.background_color.a == 1. &&133 render->options.selection_color.a == 1.)134 ? render->subpixel : FCFT_SUBPIXEL_NONE;135136 int x = render->border_size + render->x_margin;137 int y = render->border_size + render->y_margin + font->ascent;138139 wchar_t prev = 0;140141 for (size_t i = 0; i < prompt_len + text_len; i++) {142 wchar_t wc = i < prompt_len ? pprompt[i] : ptext[i - prompt_len];142 const struct fcft_glyph *glyph = fcft_glyph_rasterize(font, wc, subpixel_antialias);143 const struct fcft_glyph *glyph = fcft_glyph_rasterize(font, wc, subpixel);144 if (glyph == NULL) {145 prev = wc;146 continue;147 }
20 unmodified lines
168169static void170render_match_text(struct buffer *buf, double *_x, double _y,171 const wchar_t *text, ssize_t start, size_t length,171 struct fcft_font *font, bool subpixel_antialias,172 struct fcft_font *font, enum fcft_subpixel subpixel,173 pixman_color_t regular_color, pixman_color_t match_color)174{175 int x = *_x;176 int y = _y;177178 for (size_t i = 0; i < wcslen(text); i++) {178 const struct fcft_glyph *glyph = fcft_glyph_rasterize(font, text[i], subpixel_antialias);179 const struct fcft_glyph *glyph = fcft_glyph_rasterize(font, text[i], subpixel);180 if (glyph == NULL)181 continue;182183 long x_kern = 0, y_kern = 0;
259 unmodified lines
modified:wayland.c+10 added-8 removed
143 unmodified lines
144 int width;145 int height;146 int scale;147 unsigned dpi;148 enum fcft_subpixel subpixel;149150 enum { KEEP_RUNNING, EXIT_UPDATE_CACHE, EXIT} status;151 int exit_code;152 bool dmenu_mode;
1137 unmodified lines
1290wayl_refresh(struct wayland *wayl)1291{1292 struct buffer *buf = shm_get_buffer(wayl->shm, wayl->width, wayl->height);12931294 render_set_subpixel(wayl->render, wayl->subpixel);12951296 /* Background + border */1297 render_background(wayl->render, buf);12981299 /* Window content */
48 unmodified lines
1348 tll_foreach(wayl->monitors, it) {1349 if (it->item.output != wl_output)1350 continue;13511352 enum fcft_subpixel old_subpixel = wayl->subpixel;1353 int old_scale = wayl->scale;1354 int old_dpi = wayl->dpi;13551356 wayl->monitor = &it->item;1357 wayl->subpixel = wayl->monitor->subpixel;1358 update_size(wayl);13591355 if (wayl->scale != old_scale || wayl->dpi != old_dpi)1360 if (wayl->scale != old_scale ||1361 wayl->dpi != old_dpi ||1362 wayl->subpixel != old_subpixel)1363 {1364 wayl_refresh(wayl);1365 }1366 break;1367 }1368}1369
185 unmodified lines
1555{1556 wl_display_flush(wayl->display);1557}15581550enum fcft_subpixel1551wayl_subpixel(const struct wayland *wayl)1552{1553 return wayl->monitor != NULL1554 ? wayl->monitor->subpixel : FCFT_SUBPIXEL_DEFAULT;1555}15561559bool1560wayl_exit_code(const struct wayland *wayl)1561{1562 return wayl->exit_code;
7 unmodified lines
modified:wayland.h-1 removed
25 unmodified lines
2627void wayl_refresh(struct wayland *wayl);28void wayl_flush(struct wayland *wayl);2930enum fcft_subpixel wayl_subpixel(const struct wayland *wayl);30bool wayl_exit_code(const struct wayland *wayl);31bool wayl_update_cache(const struct wayland *wayl);