From fb0e358feccc45c7cd642e346d07f4f7f21b484b Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Wed, 3 Nov 2021 01:22:20 +0000 Subject: Don't use Pango by default. Initialising Pango makes up a large portion of the startup time, and we can achieve neater rendering with pure Cairo if we're just drawing circles anyway. Therefore, this commit avoids loading Pango if no options which require it are specified (such as --font-name or --password-character). This reduces startup time with no background image to ~40ms on my machine (2015 MacBook Pro). --- src/entry.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/entry.h') diff --git a/src/entry.h b/src/entry.h index 05c459b..b0e9542 100644 --- a/src/entry.h +++ b/src/entry.h @@ -15,9 +15,11 @@ struct entry { struct { PangoContext *context; PangoLayout *layout; + } pango; + struct { cairo_surface_t *surface; cairo_t *cr; - } pangocairo; + } cairo; PangoRectangle text_bounds; wchar_t password[MAX_PASSWORD_LENGTH]; @@ -28,6 +30,8 @@ struct entry { bool password_visible; /* Options */ + bool use_pango; + uint32_t dot_radius; uint32_t font_size; const char *font_name; uint32_t padding; -- cgit v1.2.3