diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-07-17 14:12:34 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-07-18 03:48:01 +0000 |
| commit | 59f0a721c4663aafd30179e34a38165dd137a0db (patch) | |
| tree | 4a9556d86479d36273e2878efe01d1a885146321 | |
| parent | term: 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.c | 13 | ||||
| -rw-r--r-- | wayland.h | 1 |
2 files changed, 9 insertions, 5 deletions
@@ -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); @@ -374,7 +374,6 @@ struct wl_window { bool unmapped; float scale; - bool have_preferred_scale; struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration; |
