From affd7f3f6d1c7f7765720f0ef66a117ae3512f6a Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Thu, 28 Jul 2022 12:34:24 +0200 Subject: [PATCH] Allow to query client-side cursor support Add a function nvnc_client_supports_cursor() to enable the API user to make an informed decision whether nvnc_set_cursor() can be expected to make the client draw the cursor, or whether it has to be rendered into the framebuffer. --- include/neatvnc.h | 1 + src/server.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/neatvnc.h b/include/neatvnc.h index c4d413c..30b8cd8 100644 --- a/include/neatvnc.h +++ b/include/neatvnc.h @@ -128,6 +128,7 @@ void nvnc_set_userdata(void* self, void* userdata, nvnc_cleanup_fn); void* nvnc_get_userdata(const void* self); struct nvnc* nvnc_client_get_server(const struct nvnc_client* client); +bool nvnc_client_supports_cursor(const struct nvnc_client* client); void nvnc_set_name(struct nvnc* self, const char* name); diff --git a/src/server.c b/src/server.c index 1185ef3..94fc41b 100644 --- a/src/server.c +++ b/src/server.c @@ -1569,6 +1569,16 @@ struct nvnc* nvnc_client_get_server(const struct nvnc_client* client) return client->server; } +EXPORT +bool nvnc_client_supports_cursor(const struct nvnc_client* client) +{ + for (size_t i = 0; i < client->n_encodings; ++i) { + if (client->encodings[i] == RFB_ENCODING_CURSOR) + return true; + } + return false; +} + EXPORT void nvnc_set_name(struct nvnc* self, const char* name) {