From 88e713b981c8760c255b19009918ee94f60fbdc1 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Tue, 26 Jul 2022 17:51:31 +0100 Subject: Add automatic detection of number of results. Tofi will now try to autodetect how many results can be drawn if --num-results=0 is specified, which is now the default. --- src/entry.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/entry.c') diff --git a/src/entry.c b/src/entry.c index 89f274f..e308a3c 100644 --- a/src/entry.c +++ b/src/entry.c @@ -131,6 +131,14 @@ void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, u entry_backend_harfbuzz_init(entry, &width, &height); } + /* Store the clip rectangle width and height. */ + cairo_matrix_t mat; + cairo_get_matrix(cr, &mat); + entry->clip_x = mat.x0; + entry->clip_y = mat.y0; + entry->clip_width = width; + entry->clip_height = height; + /* * Perform an initial render of the text. * This is done here rather than by calling entry_update to avoid the @@ -159,8 +167,6 @@ void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, u * frame has been displayed on screen (and while the user is unlikely * to press another key for the <10ms it takes to memcpy). */ - cairo_matrix_t mat; - cairo_get_matrix(cr, &mat); cairo_set_matrix(entry->cairo[1].cr, &mat); cairo_rectangle(entry->cairo[1].cr, 0, 0, width, height); cairo_clip(entry->cairo[1].cr); -- cgit v1.2.3