From ade0cff254462ea434652141b61fb9f45d43b435 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 6 Jun 2017 11:01:51 +0200 Subject: [PATCH] add custom cursor instead of a black 'x' we now have a 'proper' cursor with a white edge, to be able to see it when we are in the novnc console Signed-off-by: Dominik Csapak --- vncterm.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/vncterm.c b/vncterm.c index ed77f58..ff24953 100644 --- a/vncterm.c +++ b/vncterm.c @@ -2201,6 +2201,63 @@ new_client (rfbClientPtr client) static char *vncticket = NULL; +static void +MakeRichCursor(rfbScreenInfoPtr rfbScreen) +{ + int w = 16, + h = 16; + rfbCursorPtr c = rfbScreen->cursor; + char bitmap[] = + " " + " x " + " xx " + " xxx " + " xxxx " + " xxxxx " + " xxxxxx " + " xxxxxxx " + " xxxxxxxx " + " xxxxxxxxx " + " xxxxxxxxxx " + " xxxx " + " xxx " + " xx " + " x " + " "; + char edge[] = + " " + " x " + " xx " + " x x " + " x x " + " x x " + " x x " + " x x " + " x x " + " x x " + " x xxxxxx " + " x x " + " x x " + " xx " + " x " + " "; + + c = rfbScreen->cursor = rfbMakeXCursor(w,h,bitmap,bitmap); + c->richSource = (unsigned char*)calloc(w*h, 1); + c->cleanupRichSource = TRUE; + + for(int j=0;jrichSource[pos] = 15; // white + } else { + c->richSource[pos] = 0; // black + } + } + } +} + vncTerm * create_vncterm (int argc, char** argv, int maxx, int maxy) { @@ -2208,6 +2265,7 @@ create_vncterm (int argc, char** argv, int maxx, int maxy) rfbScreenInfoPtr screen = rfbGetScreen (&argc, argv, maxx, maxy, 8, 1, 1); screen->frameBuffer=(char*)calloc(maxx*maxy, 1); + MakeRichCursor(screen); char **passwds = calloc(sizeof(char**), 2); -- 2.39.2