From 63bd0b75d57dde7f0a596bb3bd4d277c31e2665c Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Fri, 27 Sep 2024 22:37:47 +0100 Subject: [PATCH] Reapply "wayland: Commit viewport resizes (#16419)" (#17026) (#17030) This reverts commit 3ee3f2ae526e7a07b56b1da9397c0b0061632fe4. Removing roundtrips seems to keep things snappy whilst fixing COSMIC. --- gfx/common/wayland_common.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gfx/common/wayland_common.c b/gfx/common/wayland_common.c index e684c6684e..47731ebc36 100644 --- a/gfx/common/wayland_common.c +++ b/gfx/common/wayland_common.c @@ -130,8 +130,12 @@ void xdg_toplevel_handle_configure_common(gfx_ctx_wayland_data_t *wl, wl->buffer_height = wl->fractional_scale ? FRACTIONAL_SCALE_MULT(wl->height, wl->fractional_scale_num) : wl->height * wl->buffer_scale; wl->resize = true; - if (wl->viewport) /* Update viewport */ + if (wl->viewport) + { + /* Stretch old buffer to fill new size, commit/roundtrip to apply */ wp_viewport_set_destination(wl->viewport, wl->width, wl->height); + wl_surface_commit(wl->surface); + } } if (floating) @@ -198,8 +202,12 @@ void libdecor_frame_handle_configure_common(struct libdecor_frame *frame, wl->buffer_height = wl->fractional_scale ? FRACTIONAL_SCALE_MULT(height, wl->fractional_scale_num) : height * wl->buffer_scale; wl->resize = true; - if (wl->viewport) /* Update viewport */ + if (wl->viewport) + { + /* Stretch old buffer to fill new size, commit/roundtrip to apply */ wp_viewport_set_destination(wl->viewport, wl->width, wl->height); + wl_surface_commit(wl->surface); + } } state = wl->libdecor_state_new(wl->width, wl->height); @@ -842,8 +850,12 @@ bool gfx_ctx_wl_set_video_mode_common_size(gfx_ctx_wayland_data_t *wl, wl->buffer_height = wl->fractional_scale ? FRACTIONAL_SCALE_MULT(wl->buffer_height, wl->fractional_scale_num) : wl->buffer_height * wl->buffer_scale; } - if (wl->viewport) /* Update viewport */ + if (wl->viewport) + { + /* Stretch old buffer to fill new size, commit/roundtrip to apply */ wp_viewport_set_destination(wl->viewport, wl->width, wl->height); + wl_surface_commit(wl->surface); + } #ifdef HAVE_LIBDECOR_H if (wl->libdecor)