fix(popup): fit the current X11 monitor

This commit is contained in:
2026-08-14 22:54:15 +09:00
parent 59482d00f3
commit 38475318db
8 changed files with 505 additions and 115 deletions

8
font.c
View File

@@ -13,8 +13,8 @@ resetlayout(void)
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
}
static void
textclear(void)
void
textclose(void)
{
if(layout != nil)
g_object_unref(layout);
@@ -52,7 +52,7 @@ setfont(void)
int
textinit(void)
{
textclear();
textclose();
fontmap = pango_cairo_font_map_new();
if(fontmap == nil){
fprint(2, "strans: popup: can't initialize PangoCairo\n");
@@ -64,7 +64,7 @@ textinit(void)
layout = pango_layout_new(context);
if(context == nil || layout == nil){
fprint(2, "strans: popup: can't create text layout\n");
textclear();
textclose();
return 0;
}
pango_layout_set_single_paragraph_mode(layout, TRUE);