summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Wick <sebastian.wick@redhat.com>2023-03-27 21:59:41 +0200
committerLeandro Ribeiro <leandrohr@riseup.net>2023-04-20 11:42:15 +0000
commit34400d7d1686d53ceaf79ff1142349a1a171db68 (patch)
tree585f8bd92af7c89b1b83218c0e0751df8e6f5f3d
parent6c27f0b87ccd0e01c9f70e5c1cababed7284ef1b (diff)
downloadweston-34400d7d1686d53ceaf79ff1142349a1a171db68.tar.gz
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 <sebastian.wick@redhat.com>
-rw-r--r--clients/simple-dmabuf-feedback.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/clients/simple-dmabuf-feedback.c b/clients/simple-dmabuf-feedback.c
index eaec1fbb..e5b7f9b0 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