aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-06-22 12:39:49 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-06-29 13:38:22 +0000
commit29a14632d369c6a9d2ceea70e75f17dc47ab23ec (patch)
tree729ef8836194a52e70aa0c5e246992a09aaa8668
parentterm: reload_fonts(): ‘scale’ is not a float (diff)
wayland: csd_reload_font(): ‘scale’ is now a float
-rw-r--r--wayland.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/wayland.c b/wayland.c
index b5bca9ba..575d2e83 100644
--- a/wayland.c
+++ b/wayland.c
@@ -32,12 +32,12 @@
#include "xmalloc.h"
static void
-csd_reload_font(struct wl_window *win, int old_scale)
+csd_reload_font(struct wl_window *win, float old_scale)
{
struct terminal *term = win->term;
const struct config *conf = term->conf;
- const int scale = term->scale;
+ const float scale = term->scale;
bool enable_csd = win->csd_mode == CSD_YES && !win->is_fullscreen;
if (!enable_csd)
@@ -52,10 +52,10 @@ csd_reload_font(struct wl_window *win, int old_scale)
patterns[i] = conf->csd.font.arr[i].pattern;
char pixelsize[32];
- snprintf(pixelsize, sizeof(pixelsize),
- "pixelsize=%u", conf->csd.title_height * scale * 1 / 2);
+ snprintf(pixelsize, sizeof(pixelsize), "pixelsize=%u",
+ (int)round(conf->csd.title_height * scale * 1 / 2));
- LOG_DBG("loading CSD font \"%s:%s\" (old-scale=%d, scale=%d)",
+ LOG_DBG("loading CSD font \"%s:%s\" (old-scale=%.2f, scale=%.2f)",
patterns[0], pixelsize, old_scale, scale);
win->csd.font = fcft_from_name(conf->csd.font.count, patterns, pixelsize);
@@ -79,7 +79,7 @@ csd_instantiate(struct wl_window *win)
xassert(ret);
}
- csd_reload_font(win, -1);
+ csd_reload_font(win, -1.);
}
static void
@@ -334,7 +334,7 @@ update_term_for_output_change(struct terminal *term)
if (tll_length(term->window->on_outputs) == 0)
return;
- int old_scale = term->scale;
+ float old_scale = term->scale;
render_resize(term, term->width / term->scale, term->height / term->scale);
term_font_dpi_changed(term, old_scale);