diff options
-rw-r--r-- | src/config.c | 20 | ||||
-rw-r--r-- | src/entry.c | 8 | ||||
-rw-r--r-- | src/entry.h | 1 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c index 470b4ae..48f1e03 100644 --- a/src/config.c +++ b/src/config.c @@ -75,6 +75,7 @@ static char *strip(const char *str); static bool parse_option(struct tofi *tofi, const char *filename, size_t lineno, const char *option, const char *value); static char *get_config_path(void); static uint32_t fixup_percentage(uint32_t value, uint32_t base, bool is_percent, uint32_t scale, bool use_scale); +static void fixup_text_theme(struct text_theme *theme, uint32_t scale); static uint32_t parse_anchor(const char *filename, size_t lineno, const char *str, bool *err); static bool parse_bool(const char *filename, size_t lineno, const char *str, bool *err); @@ -543,6 +544,15 @@ uint32_t fixup_percentage(uint32_t value, uint32_t base, bool is_percent, uint32 return value; } +void fixup_text_theme(struct text_theme *theme, uint32_t scale) +{ + theme->background_corner_radius *= scale; + theme->padding.top *= scale; + theme->padding.bottom *= scale; + theme->padding.left *= scale; + theme->padding.right *= scale; +} + void config_fixup_values(struct tofi *tofi) { uint32_t scale = tofi->window.scale; @@ -550,14 +560,20 @@ void config_fixup_values(struct tofi *tofi) if (tofi->use_scale) { struct entry *entry = &tofi->window.entry; - tofi->window.entry.font_size *= scale; + entry->font_size *= scale; entry->prompt_padding *= scale; entry->corner_radius *= scale; - entry->selection_background_padding *= scale; entry->result_spacing *= scale; entry->input_width *= scale; entry->outline_width *= scale; entry->border_width *= scale; + + fixup_text_theme(&entry->prompt_theme, scale); + fixup_text_theme(&entry->placeholder_theme, scale); + fixup_text_theme(&entry->input_theme, scale); + fixup_text_theme(&entry->default_result_theme, scale); + fixup_text_theme(&entry->alternate_result_theme, scale); + fixup_text_theme(&entry->selection_theme, scale); } /* These values should only be scaled if they're not percentages. */ diff --git a/src/entry.c b/src/entry.c index 6af9969..2ea14ac 100644 --- a/src/entry.c +++ b/src/entry.c @@ -45,16 +45,16 @@ static void apply_text_theme_fallback(struct text_theme *theme, const struct tex static void fixup_padding_sizes(struct directional *padding, uint32_t clip_width, uint32_t clip_height) { - if (padding->top == -1) { + if (padding->top < 0) { padding->top = clip_height; } - if (padding->bottom == -1) { + if (padding->bottom < 0) { padding->bottom = clip_height; } - if (padding->left == -1) { + if (padding->left < 0) { padding->left = clip_width; } - if (padding->right == -1) { + if (padding->right < 0) { padding->right = clip_width; } } diff --git a/src/entry.h b/src/entry.h index f5b5f79..a9353a5 100644 --- a/src/entry.h +++ b/src/entry.h @@ -93,7 +93,6 @@ struct entry { bool padding_left_is_percent; bool padding_right_is_percent; bool clip_to_padding; - int32_t selection_background_padding; uint32_t input_width; uint32_t border_width; uint32_t outline_width; |