mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-02 07:15:31 -04: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)
|
uint32_t scale)
|
||||||
{
|
{
|
||||||
struct wl_window *win = data;
|
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);
|
update_term_for_output_change(win->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1971,7 +1976,7 @@ wayl_surface_scale_explicit_width_height(
|
||||||
int width, int height, float scale)
|
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)
|
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||||
LOG_DBG("scaling by a factor of %.2f using fractional scaling "
|
LOG_DBG("scaling by a factor of %.2f using fractional scaling "
|
||||||
"(width=%d, height=%d) ", scale, width, height);
|
"(width=%d, height=%d) ", scale, width, height);
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,6 @@ struct wl_window {
|
||||||
bool unmapped;
|
bool unmapped;
|
||||||
|
|
||||||
float scale;
|
float scale;
|
||||||
bool have_preferred_scale;
|
|
||||||
|
|
||||||
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
|
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue