diff --git a/examples/draw.c b/examples/draw.c index 0b438e3..d2743df 100644 --- a/examples/draw.c +++ b/examples/draw.c @@ -281,7 +281,7 @@ int main(int argc, char* argv[]) struct nvnc_fb* cursor = create_cursor(); assert(cursor); - nvnc_set_cursor(server, cursor, 0, 0, 32, 32); + nvnc_set_cursor(server, cursor, 0, 0, 32, 32, true); nvnc_fb_unref(cursor); struct aml_signal* sig = aml_signal_new(SIGINT, on_sigint, NULL, NULL); diff --git a/include/neatvnc.h b/include/neatvnc.h index 8899eda..bec11b1 100644 --- a/include/neatvnc.h +++ b/include/neatvnc.h @@ -143,4 +143,5 @@ void nvnc_display_feed_buffer(struct nvnc_display*, struct nvnc_fb*, void nvnc_send_cut_text(struct nvnc*, const char* text, uint32_t len); void nvnc_set_cursor(struct nvnc*, struct nvnc_fb*, uint16_t width, - uint16_t height, uint16_t hotspot_x, uint16_t hotspot_y); + uint16_t height, uint16_t hotspot_x, uint16_t hotspot_y, + bool is_damaged); diff --git a/src/server.c b/src/server.c index d7ff0af..9d226f9 100644 --- a/src/server.c +++ b/src/server.c @@ -1574,7 +1574,8 @@ cert_alloc_failure: EXPORT void nvnc_set_cursor(struct nvnc* self, struct nvnc_fb* fb, uint16_t width, - uint16_t height, uint16_t hotspot_x, uint16_t hotspot_y) + uint16_t height, uint16_t hotspot_x, uint16_t hotspot_y, + bool is_damaged) { if (self->cursor.buffer) { nvnc_fb_release(self->cursor.buffer); @@ -1582,6 +1583,7 @@ void nvnc_set_cursor(struct nvnc* self, struct nvnc_fb* fb, uint16_t width, } self->cursor.buffer = fb; + if (fb) { // TODO: Hash cursors to check if they actually changed? nvnc_fb_ref(fb); @@ -1599,6 +1601,9 @@ void nvnc_set_cursor(struct nvnc* self, struct nvnc_fb* fb, uint16_t width, self->cursor.hotspot_y = 0; } + if (!is_damaged) + return; + self->cursor_seq++; struct nvnc_client* client;