main: Set upper bounds on pointer manager version

v0.4
Andri Yngvason 2021-12-15 23:29:47 +00:00
parent 743cfe18b3
commit 6421d76629
1 changed files with 5 additions and 5 deletions

View File

@ -81,8 +81,6 @@ struct wayvnc {
struct zwp_virtual_keyboard_manager_v1* keyboard_manager; struct zwp_virtual_keyboard_manager_v1* keyboard_manager;
struct zwlr_virtual_pointer_manager_v1* pointer_manager; struct zwlr_virtual_pointer_manager_v1* pointer_manager;
int pointer_manager_version;
const struct output* selected_output; const struct output* selected_output;
const struct seat* selected_seat; const struct seat* selected_seat;
@ -169,8 +167,7 @@ static void registry_add(void* data, struct wl_registry* registry,
self->pointer_manager = self->pointer_manager =
wl_registry_bind(registry, id, wl_registry_bind(registry, id,
&zwlr_virtual_pointer_manager_v1_interface, &zwlr_virtual_pointer_manager_v1_interface,
version); MIN(2, version));
self->pointer_manager_version = version;
return; return;
}; };
@ -957,7 +954,10 @@ int main(int argc, char* argv[])
self.pointer_backend.vnc = self.nvnc; self.pointer_backend.vnc = self.nvnc;
self.pointer_backend.output = self.selected_output; self.pointer_backend.output = self.selected_output;
self.pointer_backend.pointer = self.pointer_manager_version == 2 int pointer_manager_version =
zwlr_virtual_pointer_manager_v1_get_version(self.pointer_manager);
self.pointer_backend.pointer = pointer_manager_version >= 2
? zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output( ? zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output(
self.pointer_manager, self.selected_seat->wl_seat, self.pointer_manager, self.selected_seat->wl_seat,
out->wl_output) out->wl_output)