From 0947765fc9a4f6fc4287acfcd2efcaf4fef1ffb8 Mon Sep 17 00:00:00 2001
From: M Stoeckl <code@mstoeckl.com>
Date: Thu, 31 Oct 2024 10:27:47 -0400
Subject: Only call render_menu once per frame

An actual surface is not needed to estimate font sizes; a 1x1 image
will do, as long as the cairo context has the same options.
---
 menu.h | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'menu.h')

diff --git a/menu.h b/menu.h
index 280cdd0..8dcd99c 100644
--- a/menu.h
+++ b/menu.h
@@ -1,6 +1,7 @@
 #ifndef WMENU_MENU_H
 #define WMENU_MENU_H
 
+#include <cairo/cairo.h>
 #include <stdbool.h>
 #include <sys/types.h>
 #include <xkbcommon/xkbcommon.h>
@@ -51,6 +52,10 @@ struct menu {
 
 	struct wl_context *context;
 
+	// 1x1 surface used estimate text sizes with pango
+	cairo_surface_t *test_surface;
+	cairo_t *test_cairo;
+
 	int width;
 	int height;
 	int line_height;
-- 
cgit v1.2.3