1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-16 00:03:45 +00:00

1. Updated Mouse Cursor Update to be event driven

2. Added support for remote mouse cursor rendering on Windows
This commit is contained in:
Bryan Roe
2020-02-25 15:24:00 -08:00
parent 2669b10a5b
commit 7c77677b3e
7 changed files with 303 additions and 118 deletions

View File

@@ -478,7 +478,7 @@ int get_tile_at(int x, int y, void** buffer, long long *bufferSize, void *deskto
}
// This function captures the entire desktop buffer to scan.
int get_desktop_buffer(void **buffer, long long *bufferSize)
int get_desktop_buffer(void **buffer, long long *bufferSize, long* mouseMove)
{
BITMAPINFO bmpInfo;
@@ -502,6 +502,36 @@ int get_desktop_buffer(void **buffer, long long *bufferSize)
KVMDEBUG("BitBlt() returned FALSE", 0);
return 1; // If the copy fails, error out.
}
if (mouseMove[0] != 0)
{
CURSORINFO info = { 0 };
BITMAP bm;
ICONINFO ii;
info.cbSize = sizeof(info);
GetCursorInfo(&info);
GetIconInfo(info.hCursor, &ii);
if (GetObject(ii.hbmMask, sizeof(bm), &bm) == sizeof(bm))
{
HDC hdcScreen = GetDC(NULL);
if (hdcScreen != NULL)
{
HDC hdcMem = CreateCompatibleDC(hdcScreen);
HBITMAP hbmCanvas = CreateCompatibleBitmap(hdcScreen, bm.bmWidth, ii.hbmColor ? bm.bmHeight : (bm.bmHeight / 2));
if(hdcMem!=NULL && hbmCanvas != NULL)
{
HGDIOBJ hbmold = SelectObject(hdcMem, hbmCanvas);
DrawIconEx(hdcMem, 0, 0, info.hCursor, bm.bmWidth, ii.hbmColor ? bm.bmHeight : (bm.bmHeight / 2), 0, NULL, DI_NORMAL);
BitBlt(hCaptureDC, mouseMove[1], mouseMove[2], bm.bmWidth, ii.hbmColor ? bm.bmHeight : (bm.bmHeight / 2), hdcMem, 0, 0, SRCPAINT);
SelectObject(hdcMem, hbmold);
}
if (hbmCanvas != NULL) { DeleteObject(hbmCanvas); }
if (hdcMem != NULL) { ReleaseDC(NULL, hdcMem); }
if (hdcScreen != NULL) { ReleaseDC(NULL, hdcScreen); }
}
}
}
}
else
{