Skip to content

Instantly share code, notes, and snippets.

@MurphyMc
Created January 8, 2023 09:13
Show Gist options
  • Select an option

  • Save MurphyMc/94e7d61143a9d41a90bb2f7ffde395b7 to your computer and use it in GitHub Desktop.

Select an option

Save MurphyMc/94e7d61143a9d41a90bb2f7ffde395b7 to your computer and use it in GitHub Desktop.
Creates a nice cursor for libvncserver
static void init_cursor (rfbScreenInfoPtr rfbScreen)
{
char * cursor =
"X "
"XX "
"X X "
"X X "
"X X "
"X X "
"X X "
"X X "
"X X "
"X X "
"X X "
"X X"
"X XXXXX"
"X X X "
"X X X X "
"X X X X "
"XX X X "
" X X "
" XX ";
char * mask =
"X "
"XX "
"XXX "
"XXXX "
"XXXXX "
"XXXXXX "
"XXXXXXX "
"XXXXXXXX "
"XXXXXXXXX "
"XXXXXXXXXX "
"XXXXXXXXXXX "
"XXXXXXXXXXXX"
"XXXXXXXXXXXX"
"XXXXXXXX "
"XXXX XXXX "
"XXX XXXX "
"XX XXXX "
" XXXX "
" XX ";
// To invert, change cursor to a char[] and then...
//for (int i = 0; i < sizeof(cursor); ++i)
// cursor[i] = (cursor[i] == ' ') ? 'x' : ' ';
rfbScreen->cursor = rfbMakeXCursor(12, 19, cursor, mask);
rfbScreen->cursor->xhot = 2;
rfbScreen->cursor->yhot = 3;
rfbScreen->cursor->richSource = NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment