From a5abb118e0e61587adfa7b4e4cc72948311381d3 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 3 Apr 2022 21:23:10 +0200 Subject: try to handle graphical cursor rendering in a more generic way --- vbox.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vbox.h') diff --git a/vbox.h b/vbox.h index 69721aa..a4ad727 100644 --- a/vbox.h +++ b/vbox.h @@ -145,4 +145,13 @@ static int vbox_set_pointer_visible(LPVBOXCOMM vb, bool visible) return req->header.rc; } +/** Computes size of a VMMDevReqMousePointer message. */ +static inline unsigned vbox_req_mouse_pointer_size(unsigned width, unsigned height) +{ + const unsigned and_mask_size = (width + 7) / 8 * height; + const unsigned xor_mask_size = width * height * 4; + const unsigned data_size = and_mask_size + xor_mask_size; + return MAX(sizeof(VMMDevReqMousePointer), 24 + 20 + data_size); +} + #endif -- cgit v1.2.3