mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 07:51:28 +00: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,7 +4,6 @@
|
||||||
struct swaynag_type {
|
struct swaynag_type {
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
char *font; // Used for debugging.
|
|
||||||
PangoFontDescription *font_description;
|
PangoFontDescription *font_description;
|
||||||
char *output;
|
char *output;
|
||||||
uint32_t anchors;
|
uint32_t anchors;
|
||||||
|
|
|
@ -226,10 +226,8 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
|
||||||
break;
|
break;
|
||||||
case 'f': // Font
|
case 'f': // Font
|
||||||
if (type) {
|
if (type) {
|
||||||
free(type->font);
|
|
||||||
pango_font_description_free(type->font_description);
|
pango_font_description_free(type->font_description);
|
||||||
type->font = strdup(optarg);
|
type->font_description = pango_font_description_from_string(optarg);
|
||||||
type->font_description = pango_font_description_from_string(type->font);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l': // Detailed Message
|
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, "Anchors: %" PRIu32, swaynag.type->anchors);
|
||||||
sway_log(SWAY_DEBUG, "Type: %s", swaynag.type->name);
|
sway_log(SWAY_DEBUG, "Type: %s", swaynag.type->name);
|
||||||
sway_log(SWAY_DEBUG, "Message: %s", swaynag.message);
|
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");
|
sway_log(SWAY_DEBUG, "Buttons");
|
||||||
for (int i = 0; i < swaynag.buttons->length; i++) {
|
for (int i = 0; i < swaynag.buttons->length; i++) {
|
||||||
struct swaynag_button *button = swaynag.buttons->items[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) {
|
void swaynag_types_add_default(list_t *types) {
|
||||||
struct swaynag_type *type_defaults = swaynag_type_new("<defaults>");
|
struct swaynag_type *type_defaults = swaynag_type_new("<defaults>");
|
||||||
type_defaults->font = strdup("pango:Monospace 10");
|
|
||||||
type_defaults->font_description =
|
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
|
type_defaults->anchors = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
|
||||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
|
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
|
||||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
||||||
|
@ -92,10 +91,6 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->font) {
|
|
||||||
dest->font = strdup(src->font);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src->font_description) {
|
if (src->font_description) {
|
||||||
dest->font_description = pango_font_description_copy(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) {
|
void swaynag_type_free(struct swaynag_type *type) {
|
||||||
free(type->name);
|
free(type->name);
|
||||||
free(type->font);
|
|
||||||
pango_font_description_free(type->font_description);
|
pango_font_description_free(type->font_description);
|
||||||
free(type->output);
|
free(type->output);
|
||||||
free(type);
|
free(type);
|
||||||
|
|
Loading…
Reference in a new issue