From fc1cc7656a54256e94e41ad4992b8b753daf4c8a Mon Sep 17 00:00:00 2001 From: Jaeyong Lee Date: Thu, 28 May 2026 22:03:58 +0900 Subject: [PATCH] screencopy-v1: fail concurrent capture_output requests Send the failed event immediately when a client sends capture_output or capture_output_region for an output that already has a live frame owned by that client. Enforces one frame per (client, output) pair, matching ext-image-copy- capture-v1's create_frame restriction without adding a new error code or bumping the interface version. --- types/wlr_screencopy_v1.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 9916a604c..30287b79e 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -512,6 +512,16 @@ static void capture_output(struct wl_client *wl_client, return; } + struct wlr_screencopy_frame_v1 *existing; + wl_list_for_each(existing, &client->manager->frames, link) { + if (existing->client == client && existing->output == output) { + wl_resource_set_user_data(frame->resource, NULL); + zwlr_screencopy_frame_v1_send_failed(frame->resource); + free(frame); + return; + } + } + frame->client = client; client->ref++;