summaryrefslogtreecommitdiff
path: root/src/entry_backend/pango.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/entry_backend/pango.c')
-rw-r--r--src/entry_backend/pango.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/entry_backend/pango.c b/src/entry_backend/pango.c
index 13e21ee..3f424ce 100644
--- a/src/entry_backend/pango.c
+++ b/src/entry_backend/pango.c
@@ -26,23 +26,6 @@ void entry_backend_pango_init(struct entry *entry, uint32_t *width, uint32_t *he
pango_font_description_free(font_description);
entry->pango.layout = pango_layout_new(context);
- log_debug("Setting Pango text.\n");
- pango_layout_set_text(entry->pango.layout, entry->prompt_text, -1);
- log_debug("First Pango draw.\n");
- pango_cairo_update_layout(cr, entry->pango.layout);
-
- /* Draw the prompt now, as this only needs to be done once */
- struct color color = entry->foreground_color;
- cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
- pango_cairo_show_layout(cr, entry->pango.layout);
-
- /* Move and clip so we don't draw over the prompt */
- int prompt_width;
- pango_layout_get_pixel_size(entry->pango.layout, &prompt_width, NULL);
- cairo_translate(cr, prompt_width, 0);
- *width -= prompt_width;
- cairo_rectangle(cr, 0, 0, *width, *height);
- cairo_clip(cr);
entry->pango.context = context;
}
@@ -62,17 +45,26 @@ void entry_backend_pango_update(struct entry *entry)
struct color color = entry->foreground_color;
cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
-
- pango_layout_set_text(layout, entry->input_mb, -1);
+ /* Render the prompt */
+ pango_layout_set_text(layout, entry->prompt_text, -1);
pango_cairo_update_layout(cr, layout);
pango_cairo_show_layout(cr, layout);
int width;
int height;
+ pango_layout_get_pixel_size(entry->pango.layout, &width, NULL);
+ cairo_translate(cr, width, 0);
+
+
+ /* Render the entry text */
+ pango_layout_set_text(layout, entry->input_mb, -1);
+ pango_cairo_update_layout(cr, layout);
+ pango_cairo_show_layout(cr, layout);
pango_layout_get_size(layout, &width, &height);
width = MAX(width, (int)entry->input_width * PANGO_SCALE);
cairo_matrix_t mat;
+ /* Render our results */
for (size_t i = 0; i < entry->results.count; i++) {
if (entry->horizontal) {
cairo_translate(cr, (int)(width / PANGO_SCALE) + entry->result_spacing, 0);