Skip to content

Commit

Permalink
swaynag: fix NULL font description
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
emersion committed Dec 22, 2022
1 parent 1340910 commit 0500cdb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions swaynag/types.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ struct swaynag_type *swaynag_type_new(const char *name) {
void swaynag_types_add_default(list_t *types) {
struct swaynag_type *type_defaults = swaynag_type_new("<defaults>");
type_defaults->font = strdup("pango:Monospace 10");
type_defaults->font_description =
pango_font_description_from_string(type_defaults->font);
type_defaults->anchors = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
Expand Down Expand Up @@ -94,6 +96,10 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) {
dest->font = strdup(src->font);
}

if (src->font_description) {
dest->font_description = pango_font_description_copy(src->font_description);
}

if (src->output) {
dest->output = strdup(src->output);
}
Expand Down Expand Up @@ -173,6 +179,7 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) {
void swaynag_type_free(struct swaynag_type *type) {
free(type->name);
free(type->font);
pango_font_description_free(type->font_description);
free(type->output);
free(type);
}
Expand Down

0 comments on commit 0500cdb

Please sign in to comment.