diff --git a/src/output.c b/src/output.c index c286468..806eb88 100644 --- a/src/output.c +++ b/src/output.c @@ -79,6 +79,12 @@ static void frame_handle_buffer(void *data, struct zwlr_screencopy_frame_v1 *fra wl_buffer_destroy(output->frame_buffer); } + if ((int32_t)width != output->width || (int32_t)height != output->height) { + dp_log_fatal("Output/buffer size mismatch: mode=%" PRIi32 "x%" PRIi32 ", buffer=%" PRIu32 + "x%" PRIu32, + output->width, output->height, width, height); + } + output->frame_format = format; output->frame_stride = (int)stride; output->frame_buffer = dp_buffer_create(output->state, output->width, output->height, @@ -156,6 +162,10 @@ static void output_handle_geometry(void *data, struct wl_output *wl_output, int3 static void output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) { + if ((flags & WL_OUTPUT_MODE_CURRENT) == 0) { + return; + } + struct dp_output *output = data; if (output->has_geom) { @@ -178,6 +188,7 @@ static void output_handle_done(void *data, struct wl_output *wl_output) { assert(output->name != NULL); + assert(output->width > 0 && output->height > 0); if ((output->transform & WL_OUTPUT_TRANSFORM_90) != 0) { output->transformed_width = output->height; output->transformed_height = output->width;