From 08496b302c7a9e4a080542df6b4a1e294a2a668a Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Tue, 9 Apr 2024 00:56:20 +0100 Subject: [PATCH] wayland: Commit viewport resizes (#16419) This allows a resize to keep up with the users pointer movements. --- gfx/common/wayland_common.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/gfx/common/wayland_common.c b/gfx/common/wayland_common.c index eb54326a1b..0670f44615 100644 --- a/gfx/common/wayland_common.c +++ b/gfx/common/wayland_common.c @@ -131,8 +131,13 @@ 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); + wl_display_roundtrip(wl->input.dpy); + } } if (floating) @@ -196,8 +201,13 @@ 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); + wl_display_roundtrip(wl->input.dpy); + } } state = wl->libdecor_state_new(wl->width, wl->height); @@ -832,8 +842,13 @@ 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); + wl_display_roundtrip(wl->input.dpy); + } #ifdef HAVE_LIBDECOR_H if (wl->libdecor)