aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-07-17 14:12:34 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-07-18 03:48:01 +0000
commit59f0a721c4663aafd30179e34a38165dd137a0db (patch)
tree4a9556d86479d36273e2878efe01d1a885146321
parentterm: font_dpi_changed: scale (and old_scale) are floating point (diff)
wayland: fractional_scale_preferred_scale(): only push update if scale has changed
Also, drop wl_window::have_preferred_scale. Check for scale > 0 instead.
-rw-r--r--wayland.c13
-rw-r--r--wayland.h1
2 files changed, 9 insertions, 5 deletions
diff --git a/wayland.c b/wayland.c
index 9195797e..f6ded585 100644
--- a/wayland.c
+++ b/wayland.c
@@ -1603,10 +1603,15 @@ static void fractional_scale_preferred_scale(
uint32_t scale)
{
struct wl_window *win = data;
- win->scale = (float)scale / 120.;
- win->have_preferred_scale = true;
- LOG_DBG("fractional scale: %.3f", win->scale);
+ const float new_scale = (float)scale / 120.;
+
+ if (win->scale == new_scale)
+ return;
+
+ LOG_DBG("fractional scale: %.2f -> %.2f", win->scale, new_scale);
+
+ win->scale = new_scale;
update_term_for_output_change(win->term);
}
@@ -1971,7 +1976,7 @@ wayl_surface_scale_explicit_width_height(
int width, int height, float scale)
{
- if (wayl_fractional_scaling(win->term->wl) && win->have_preferred_scale) {
+ if (wayl_fractional_scaling(win->term->wl) && win->scale > 0.) {
#if defined(HAVE_FRACTIONAL_SCALE)
LOG_DBG("scaling by a factor of %.2f using fractional scaling "
"(width=%d, height=%d) ", scale, width, height);
diff --git a/wayland.h b/wayland.h
index 6d1cd727..9e581b20 100644
--- a/wayland.h
+++ b/wayland.h
@@ -374,7 +374,6 @@ struct wl_window {
bool unmapped;
float scale;
- bool have_preferred_scale;
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;