Skip to content

Commit 0500cdb

Browse files
committed
swaynag: fix NULL font description
The font description was only set if provided on the CLI. It was left NULL for the defaults and when reading from the config file. Closes: #7186 (cherry picked from commit fd0af78)
1 parent 1340910 commit 0500cdb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

swaynag/types.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ struct swaynag_type *swaynag_type_new(const char *name) {
3333
void swaynag_types_add_default(list_t *types) {
3434
struct swaynag_type *type_defaults = swaynag_type_new("<defaults>");
3535
type_defaults->font = strdup("pango:Monospace 10");
36+
type_defaults->font_description =
37+
pango_font_description_from_string(type_defaults->font);
3638
type_defaults->anchors = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
3739
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
3840
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
@@ -94,6 +96,10 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) {
9496
dest->font = strdup(src->font);
9597
}
9698

99+
if (src->font_description) {
100+
dest->font_description = pango_font_description_copy(src->font_description);
101+
}
102+
97103
if (src->output) {
98104
dest->output = strdup(src->output);
99105
}
@@ -173,6 +179,7 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) {
173179
void swaynag_type_free(struct swaynag_type *type) {
174180
free(type->name);
175181
free(type->font);
182+
pango_font_description_free(type->font_description);
176183
free(type->output);
177184
free(type);
178185
}

0 commit comments

Comments
 (0)