Disable seat completely when using disable-input

pull/142/head
shironeko 2022-05-24 23:28:45 -04:00 committed by Andri Yngvason
parent 57f31be52e
commit c07f4483b2
1 changed files with 47 additions and 45 deletions

View File

@ -144,11 +144,6 @@ static void registry_add(void* data, struct wl_registry* registry,
return;
}
if (strcmp(interface, wl_shm_interface.name) == 0) {
wl_shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
return;
}
if (strcmp(interface, zwlr_screencopy_manager_v1_interface.name) == 0) {
self->screencopy.manager =
wl_registry_bind(registry, id,
@ -157,14 +152,18 @@ static void registry_add(void* data, struct wl_registry* registry,
return;
}
if (strcmp(interface, zwlr_virtual_pointer_manager_v1_interface.name) == 0) {
self->pointer_manager =
wl_registry_bind(registry, id,
&zwlr_virtual_pointer_manager_v1_interface,
MIN(2, version));
if (strcmp(interface, wl_shm_interface.name) == 0) {
wl_shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
return;
};
}
if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0) {
zwp_linux_dmabuf = wl_registry_bind(registry, id,
&zwp_linux_dmabuf_v1_interface, 3);
return;
}
if (!self->disable_input) {
if (strcmp(interface, wl_seat_interface.name) == 0) {
struct wl_seat* wl_seat =
wl_registry_bind(registry, id, &wl_seat_interface, 7);
@ -181,6 +180,14 @@ static void registry_add(void* data, struct wl_registry* registry,
return;
}
if (strcmp(interface, zwlr_virtual_pointer_manager_v1_interface.name) == 0) {
self->pointer_manager =
wl_registry_bind(registry, id,
&zwlr_virtual_pointer_manager_v1_interface,
MIN(2, version));
return;
};
if (strcmp(interface, zwp_virtual_keyboard_manager_v1_interface.name) == 0) {
self->keyboard_manager =
wl_registry_bind(registry, id,
@ -188,13 +195,6 @@ static void registry_add(void* data, struct wl_registry* registry,
1);
return;
}
if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0) {
zwp_linux_dmabuf = wl_registry_bind(registry, id,
&zwp_linux_dmabuf_v1_interface, 3);
return;
}
if (strcmp(interface, zwlr_data_control_manager_v1_interface.name) == 0) {
if (!self->disable_input)
self->data_control.manager = wl_registry_bind(registry, id,
@ -203,6 +203,7 @@ static void registry_add(void* data, struct wl_registry* registry,
return;
}
}
}
static void registry_remove(void* data, struct wl_registry* registry,
uint32_t id)
@ -302,11 +303,12 @@ void wayvnc_destroy(struct wayvnc* self)
if (self->pointer_manager)
zwlr_virtual_pointer_manager_v1_destroy(self->pointer_manager);
if (self->screencopy.manager)
zwlr_screencopy_manager_v1_destroy(self->screencopy.manager);
if (self->data_control.manager)
zwlr_data_control_manager_v1_destroy(self->data_control.manager);
if (self->screencopy.manager)
zwlr_screencopy_manager_v1_destroy(self->screencopy.manager);
wl_registry_destroy(self->registry);
wl_display_disconnect(self->display);
}
@ -914,14 +916,14 @@ int main(int argc, char* argv[])
}
}
struct seat* seat;
struct seat* seat = NULL;
if (seat_name) {
seat = seat_find_by_name(&self.seats, seat_name);
if (!seat) {
log_error("No such seat\n");
goto failure;
}
} else {
} else if (!self.disable_input) {
seat = seat_first(&self.seats);
if (!seat) {
log_error("No seat found\n");
@ -934,7 +936,7 @@ int main(int argc, char* argv[])
self.screencopy.wl_output = out->wl_output;
self.screencopy.rate_limit = max_rate;
if (!self.disable_input && self.keyboard_manager) {
if (self.keyboard_manager) {
self.keyboard_backend.virtual_keyboard =
zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(
self.keyboard_manager, self.selected_seat->wl_seat);
@ -957,7 +959,7 @@ int main(int argc, char* argv[])
self.pointer_backend.vnc = self.nvnc;
self.pointer_backend.output = self.selected_output;
if (!self.disable_input && self.pointer_manager) {
if (self.pointer_manager) {
int pointer_manager_version =
zwlr_virtual_pointer_manager_v1_get_version(self.pointer_manager);