diff options
Diffstat (limited to 'src/wayland/buffer.c')
| -rw-r--r-- | src/wayland/buffer.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/wayland/buffer.c b/src/wayland/buffer.c index 0561da3..4cddfa5 100644 --- a/src/wayland/buffer.c +++ b/src/wayland/buffer.c @@ -200,24 +200,27 @@ static const struct wp_fractional_scale_v1_listener frac_scale_listener = { .preferred_scale = fractional_preferred_scale, }; -static void surface_follow_refresh(struct wayland_surface *w) +void surface_follow_outputs(struct wayland_surface *w) { uint32_t refresh = 0; - for (const struct wl_conn_output *o = w->conn->outputs; o; o = o->next) - if ((o->mask & w->outputs) && o->refresh_ns && - (!refresh || o->refresh_ns < refresh)) - refresh = o->refresh_ns; + int32_t max_scale = 0; + bool need_scale = !w->frac_scale && !surface_gets_preferred_scale(w->surface); + + for (const struct wl_conn_output *o = w->conn->outputs; o; o = o->next) { + if (o->mask & w->outputs) { + if (o->refresh_ns && (!refresh || o->refresh_ns < refresh)) + refresh = o->refresh_ns; + if (need_scale && o->scale > max_scale) + max_scale = o->scale; + } + } if (!refresh && w->conn->outputs) refresh = w->conn->outputs->refresh_ns; if (refresh) w->clock.refresh_ns = refresh; -} -void surface_follow_outputs(struct wayland_surface *w) -{ - surface_follow_refresh(w); - if (!w->frac_scale && !surface_gets_preferred_scale(w->surface)) - surface_request_scale(w, conn_output_scale_120(w->conn, w->outputs)); + if (need_scale) + surface_request_scale(w, (uint32_t)max_scale * YASL_SCALE_UNIT); } static void surface_enter(void *data, struct wl_surface *surface, struct wl_output *output) |
