From 34400d7d1686d53ceaf79ff1142349a1a171db68 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Mon, 27 Mar 2023 21:59:41 +0200 Subject: [PATCH] clients/simple-dmabuf-feedback: get buffer size from configure events instead of the output mode. The mode doesn't say anything about the actual output geometry which could lead to buffers extending the output region on rotated monitors. This now also works with moving the window to different monitors. Signed-off-by: Sebastian Wick --- clients/simple-dmabuf-feedback.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/clients/simple-dmabuf-feedback.c b/clients/simple-dmabuf-feedback.c index eaec1fbbc..e5b7f9b02 100644 --- a/clients/simple-dmabuf-feedback.c +++ b/clients/simple-dmabuf-feedback.c @@ -119,6 +119,9 @@ struct output { int width, height; int scale; bool initialized; + struct { + int width, height; + } configure; }; struct egl { @@ -778,6 +781,15 @@ xdg_surface_handle_configure(void *data, struct xdg_surface *surface, uint32_t serial) { struct window *window = data; + struct output *output = &window->display->output; + + if (output->configure.width != output->width || + output->configure.height != output->height) { + output->width = output->configure.width; + output->height = output->configure.height; + + window_buffers_invalidate (window); + } xdg_surface_ack_configure(surface, serial); window->wait_for_configure = false; @@ -792,6 +804,11 @@ xdg_toplevel_handle_configure(void *data, struct xdg_toplevel *toplevel, int32_t width, int32_t height, struct wl_array *states) { + struct window *window = data; + struct output *output = &window->display->output; + + output->configure.width = width; + output->configure.height = height; } static void @@ -1368,12 +1385,6 @@ static void output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width, int height, int refresh) { - struct output *output = data; - - if (flags & WL_OUTPUT_MODE_CURRENT) { - output->width = width; - output->height = height; - } } static void