summaryrefslogtreecommitdiff
path: root/src/entry.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-07-26 17:51:31 +0100
committerPhil Jones <philj56@gmail.com>2022-07-26 17:51:31 +0100
commit88e713b981c8760c255b19009918ee94f60fbdc1 (patch)
treeecdca68c12425bbec7fb2f353d28a03c4e2f5a5c /src/entry.c
parentd3bf3b017b8129ff772ad9c5658ccdfc826d0e51 (diff)
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.
Diffstat (limited to 'src/entry.c')
-rw-r--r--src/entry.c10
1 files changed, 8 insertions, 2 deletions
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);