diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-03-01 11:28:33 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-03-01 11:28:33 +0000 |
| commit | 7b1dafae0f84cde10ad8950642535ca7d9a4427c (patch) | |
| tree | c8b6d160052aaae14770377b41295f37583edef3 /render.c | |
| parent | render: csd: switch-based CSD positioning (diff) | |
render: search: kwin has problems with a resizing/repositioned sub-surface
So, make it equal to the window size, and make the non-used area fully
transparent.
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -1146,14 +1146,15 @@ render_search_box(struct terminal *term) #endif const size_t margin = csd + 3 * scale; - const size_t width = min( + const size_t width = term->width - 2 * margin; + const size_t visible_width = min( term->width - 2 * margin, 2 * margin + wanted_visible_chars * term->cell_width); const size_t height = min( term->height - 2 * margin, 2 * margin + 1 * term->cell_height); - const size_t visible_chars = (width - 2 * margin) / term->cell_width; + const size_t visible_chars = (visible_width - 2 * margin) / term->cell_width; size_t glyph_offset = term->render.search_glyph_offset; unsigned long cookie = shm_cookie_search(term); @@ -1166,10 +1167,15 @@ render_search_box(struct terminal *term) pixman_image_fill_rectangles( PIXMAN_OP_SRC, buf->pix, &color, - 1, &(pixman_rectangle16_t){0, 0, width, height}); + 1, &(pixman_rectangle16_t){width - visible_width, 0, visible_width, height}); + + pixman_color_t transparent = color_hex_to_pixman_with_alpha(0, 0); + pixman_image_fill_rectangles( + PIXMAN_OP_SRC, buf->pix, &transparent, + 1, &(pixman_rectangle16_t){0, 0, width - visible_width, height}); struct font *font = term->fonts[0]; - int x = margin; + int x = width - visible_width + margin; int y = margin; pixman_color_t fg = color_hex_to_pixman(term->colors.table[0]); @@ -1205,15 +1211,15 @@ render_search_box(struct terminal *term) if (term->search.cursor >= term->search.len) draw_bar(term, buf->pix, font, &fg, x, y); - wl_surface_attach(term->window->search_surface, buf->wl_buf, 0, 0); - wl_surface_damage_buffer(term->window->search_surface, 0, 0, width, height); - wl_surface_set_buffer_scale(term->window->search_surface, scale); - wl_subsurface_set_position( term->window->search_sub_surface, - max(0, (int32_t)term->width - width - margin) / scale, + margin / scale, max(0, (int32_t)term->height - height - margin) / scale); + wl_surface_attach(term->window->search_surface, buf->wl_buf, 0, 0); + wl_surface_damage_buffer(term->window->search_surface, 0, 0, width, height); + wl_surface_set_buffer_scale(term->window->search_surface, scale); + wl_surface_commit(term->window->search_surface); } |
