mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
wayland: fractional_scale_preferred_scale(): only push update if scale has changed
Also, drop wl_window::have_preferred_scale. Check for scale > 0 instead.
This commit is contained in:
parent
829353a5da
commit
59f0a721c4
2 changed files with 9 additions and 5 deletions
13
wayland.c
13
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);
|
||||
|
|
|
|||
|
|
@ -374,7 +374,6 @@ struct wl_window {
|
|||
bool unmapped;
|
||||
|
||||
float scale;
|
||||
bool have_preferred_scale;
|
||||
|
||||
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue