render: regression: selected entry's background not rendered on top of regular background
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Closes #405
authored by Daniel Eklöf · committed by Mark Stosberg · parent 20660ef · Browse files · 2 files·+26 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+26 added−7 removed
- other:+26 added−7 removed
Provenance
- Commit
0e0ece6- Tree
1a27ca5- Author
Daniel Eklöf <daniel@ekloef.se>- Committer
Mark Stosberg <mark@stosberg.com>- Parent
20660ef
2 files changed+26 added−7 removed
modified:CHANGELOG.md+3 added-2 removed
36 unmodified lines37 * Crash when the border size is larger than the border radius38 ([#401][401]).39 * Regression: cursor not centered when using a custom line height40 ([#403][403]).41+* Regression: selected background not rendered on top of the regular42+ background ([#405][405]).43 44 [401]: https://codeberg.org/dnkl/fuzzel/issues/40145 [403]: https://codeberg.org/dnkl/fuzzel/issues/40346+[405]: https://codeberg.org/dnkl/fuzzel/issues/40547 45-48 ### Security49 ### Contributors50 49-51 ## 1.11.052 53 ### Added54 779 unmodified linesmodified:render.c+23 added-5 removed
924 unmodified lines925 }926 927 static void928 render_match_entry_background(const struct render *render,929- int idx, int row_count, bool is_selected,929+ int idx, int row_count,930 pixman_image_t *pix, int width)931 {932- pixman_color_t bg = is_selected933- ? render->pix_selection_color : render->pix_background_color;932+ pixman_color_t bg = render->pix_background_color;933 934 const int sel_margin = render->x_margin / 3;935 936 const int x = render->border_size + render->x_margin - sel_margin;5 unmodified lines942 PIXMAN_OP_SRC, pix, &bg, 1, &(pixman_rectangle16_t){x, y, w, h});943 }944 945 static void946+render_selected_match_entry_background(const struct render *render,947+ int idx, pixman_image_t *pix, int width)948+{949+ pixman_color_t bg = render->pix_selection_color;950+951+ const int sel_margin = render->x_margin / 3;952+953+ const int x = render->border_size + render->x_margin - sel_margin;954+ const int y = first_row_y(render) + idx * render->row_height;955+ const int w = width - 2 * (render->border_size + render->x_margin - sel_margin);956+ const int h = 1 * render->row_height;957+958+ pixman_image_fill_rectangles(959+ PIXMAN_OP_OVER, pix, &bg, 1, &(pixman_rectangle16_t){x, y, w, h});960+}961+962+static void963 render_one_match_entry(const struct render *render, const struct matches *matches,964 const struct match *match, bool render_icons,965 int idx, bool is_selected, int width, int height,966 pixman_image_t *pix, cairo_t *cairo)11 unmodified lines978 const int first_row = first_row_y(render);979 double cur_x = render->border_size + render->x_margin;980 double max_x = width - render->border_size - render->x_margin;981 966- render_match_entry_background(render, idx, 1, is_selected, pix, width);982+ render_match_entry_background(render, idx, 1, pix, width);983 984 if (is_selected) {985+ render_selected_match_entry_background(render, idx, pix, width);986+987 /* If currently selected item has a scalable icon, and if988 * there's "enough" free space, render a large representation989 * of the icon */990 110 unmodified lines1101 }1102 1103 /* Erase background of the "empty" area, after the last match */1104 render_match_entry_background(1087- render, match_count, render->conf->lines - match_count, false,1105+ render, match_count, render->conf->lines - match_count,1106 buf->pix[0], buf->width);1107 1108 for (size_t i = 0; i < match_count; i++) {1109 if (render->workers.count == 0) {347 unmodified lines