screencopy: Set upper bounds on protocol version

pull/127/head
Andri Yngvason 2021-12-15 23:23:21 +00:00
parent 85563d59f8
commit 87584ef934
3 changed files with 3 additions and 4 deletions

View File

@ -47,7 +47,6 @@ struct screencopy {
struct zwlr_screencopy_manager_v1* manager; struct zwlr_screencopy_manager_v1* manager;
struct zwlr_screencopy_frame_v1* frame; struct zwlr_screencopy_frame_v1* frame;
int version;
void* userdata; void* userdata;
void (*on_done)(struct screencopy*); void (*on_done)(struct screencopy*);

View File

@ -153,8 +153,7 @@ static void registry_add(void* data, struct wl_registry* registry,
self->screencopy.manager = self->screencopy.manager =
wl_registry_bind(registry, id, wl_registry_bind(registry, id,
&zwlr_screencopy_manager_v1_interface, &zwlr_screencopy_manager_v1_interface,
version); MIN(3, version));
self->screencopy.version = version;
return; return;
} }

View File

@ -130,7 +130,8 @@ static void screencopy_buffer(void* data,
self->wl_shm_height = height; self->wl_shm_height = height;
self->wl_shm_stride = stride; self->wl_shm_stride = stride;
if (self->version < 3) { int version = zwlr_screencopy_manager_v1_get_version(self->manager);
if (version < 3) {
self->have_linux_dmabuf = false; self->have_linux_dmabuf = false;
screencopy_buffer_done(data, frame); screencopy_buffer_done(data, frame);
return; return;