mirror of
https://github.com/swaywm/sway.git
synced 2024-12-27 15:36:29 +01:00
swaynag: drop swaynag_type.font
It's too easy to have this go out of sync with font_description.
This commit is contained in:
parent
fd0af78e43
commit
bd7466e1b7
4 changed files with 5 additions and 12 deletions
|
@ -4,7 +4,6 @@
|
|||
struct swaynag_type {
|
||||
char *name;
|
||||
|
||||
char *font; // Used for debugging.
|
||||
PangoFontDescription *font_description;
|
||||
char *output;
|
||||
uint32_t anchors;
|
||||
|
|
|
@ -226,10 +226,8 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
|
|||
break;
|
||||
case 'f': // Font
|
||||
if (type) {
|
||||
free(type->font);
|
||||
pango_font_description_free(type->font_description);
|
||||
type->font = strdup(optarg);
|
||||
type->font_description = pango_font_description_from_string(type->font);
|
||||
type->font_description = pango_font_description_from_string(optarg);
|
||||
}
|
||||
break;
|
||||
case 'l': // Detailed Message
|
||||
|
|
|
@ -98,7 +98,9 @@ int main(int argc, char **argv) {
|
|||
sway_log(SWAY_DEBUG, "Anchors: %" PRIu32, swaynag.type->anchors);
|
||||
sway_log(SWAY_DEBUG, "Type: %s", swaynag.type->name);
|
||||
sway_log(SWAY_DEBUG, "Message: %s", swaynag.message);
|
||||
sway_log(SWAY_DEBUG, "Font: %s", swaynag.type->font);
|
||||
char *font = pango_font_description_to_string(swaynag.type->font_description);
|
||||
sway_log(SWAY_DEBUG, "Font: %s", font);
|
||||
free(font);
|
||||
sway_log(SWAY_DEBUG, "Buttons");
|
||||
for (int i = 0; i < swaynag.buttons->length; i++) {
|
||||
struct swaynag_button *button = swaynag.buttons->items[i];
|
||||
|
|
|
@ -32,9 +32,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);
|
||||
pango_font_description_from_string("pango:Monospace 10");
|
||||
type_defaults->anchors = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
||||
|
@ -92,10 +91,6 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (src->font) {
|
||||
dest->font = strdup(src->font);
|
||||
}
|
||||
|
||||
if (src->font_description) {
|
||||
dest->font_description = pango_font_description_copy(src->font_description);
|
||||
}
|
||||
|
@ -178,7 +173,6 @@ 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);
|
||||
|
|
Loading…
Reference in a new issue